You are viewing a single comment's thread. Return to all comments →
FASTEST Solution
using namespace std;
char str[101]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
cin >> str; int top = 0, index = 0; while(str[++index] != '\0') { if(top < 0 || str[index] != str[top]) str[++top] = str[index]; else --top; } if(top < 0) { cout << "Empty String" << endl; return 0; } str[top + 1] = '\0'; cout << str << endl; return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Super Reduced String
You are viewing a single comment's thread. Return to all comments →
FASTEST Solution
include
using namespace std;
char str[101]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
}