CSES - Datatähti 2018 peili - Results
Submission details
Task:Merkkijono
Sender:Destroy();
Submission time:2017-10-14 22:36:34 +0300
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp:1:20: fatal error: stdafx.h: No such file or directory
 #include "stdafx.h"
                    ^
compilation terminated.

Code

#include "stdafx.h"
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main() {
	string a;
	getline(cin, a);
	
	auto it = std::adjacent_find(a.begin(), a.end());
	while (true)
	{
		auto it2 = it;
		char b = *it;
		it++;
		int k = 0;
		while (it != a.end())
		{
			if (b != *it)
				break;
			k++;
			it++;
		}
		a.erase(it2, it2+k+1);
		it = std::adjacent_find(a.begin(), a.end());
		if (it == a.end()) break;
	}

	cout << a;
	cin.get();
	cin.get();
}