View Code of Problem 3924

#include <iostream>
#include <string>
#include <cstring>
#include <unordered_map>
using namespace std;

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

Double click to view unformatted code.


Back to problem 3924