General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
90367509 Practice:
Unic_0rn
363C - 12 C++14 (GCC 6-32) Wrong answer on test 1 15 ms 0 KB 2020-08-19 10:33:40 2020-08-19 10:33:40
→ Source
/*
	code_template 
	author: @unic0rn
*/

#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>

#define IL(a, b, c) for (a = b; a < c; a++)
#define DL(a, b, c) for (a = b; a >= c; a--)
#define ll long long
#define ld double
#define N 1000000007
#define MAX 10001

using namespace std;

int main()
{
	string str;
	string ans;
	int cnt1 = 1, cnt2 = 0, i;
	cin >> str;
	ans = str[0];

	IL(i, 1, str.size())
	{
		// cout << "1 " << str[i] << " ";
		if (str[i] == str[i - 1])
		{
			if (cnt1 > 0)
				cnt1++;
			else if (cnt2 > 0)
				cnt2++;
		}
		else if (cnt1 > 1)
		{
			cnt2 = 1;
			cnt1 = 0;
		}

		if (cnt1 == 3)
		{
			cnt1 = 2;
		}
		else if (cnt2 == 2)
		{
			char a = str[i];
			i++;
			// cout << "2 " << str[i] << " ";
			while (i != str.size() - 1 && str[i] == a)
			{
				i++;
				// cout << "3 " << str[i] << " ";
			}
			if (str[i] != a)
			{
				ans.push_back(str[i]);
				cnt1 = 1;
				cnt2 = 0;
			}
		}
		else
		{
			ans.push_back(str[i]);
		}
	}

	// ans.push_back('\0');

	cout << ans;

	return 0;
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details