Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilpropheta/95746d8ff69e5f4c34bc333b81d7c58c to your computer and use it in GitHub Desktop.
Save ilpropheta/95746d8ff69e5f4c34bc333b81d7c58c to your computer and use it in GitHub Desktop.
string S; cin >> S;
deque<char> st;
for (auto c : S)
{
if (!st.empty() && st.back() == c)
st.pop_back();
else
st.push_back(c);
}
if (st.empty())
cout << "Empty String";
else
{
for (auto c : st)
cout << c;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment