View Code of Problem 3924

#include<iostream>
#include<string>
#include<algorithm>
#include<stack>

using namespace std;

int main() {
	string s;
	while (cin>>s)
	{
		for (int i = 0; i < s.length()-1;)
		{
			if (s[i] == s[i+1])
				s.erase(i, 1);
			else
				i++;
		}
		cout << s << endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 3924