CSES - Datatähti 2018 alku - Results
Submission details
Task:Merkkijono
Sender:suola_makkara
Submission time:2017-10-02 16:52:43 +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 <string>
using namespace std;
int main()
{
string text;
cin >> text;
while (true)
{
int len = text.length();
int count = 1;
char ch = text[0];
for (int i = 1; i < len; i++)
{
if (ch == text[i])
{
count++;
}
else if (count > 1)
{
text.erase(i - count, count);
break;
}
else
{
count = 1;
ch = text[i];
continue;
}
if (i + 1 == len)
{
text.erase(i - count + 1, count);
}
}
if (count < 2)
{
break;
}
}
cout << text << '\n';
return 0;
}