View Code of Problem 3924

#include<iostream>
#include<cstdio>

using namespace std;

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

Double click to view unformatted code.


Back to problem 3924