You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can watch the explanation here : https://youtu.be/XgJKCkb1EjQ
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int i = 1; while(i < s.size()){ if(s[i-1] == s[i]){ s.erase(i-1, 2); if( i != 1) i--; } else i++; } if(s == "") s = "Empty String"; cout << s; 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 →
Here is my c++ solution, you can watch the explanation here : https://youtu.be/XgJKCkb1EjQ