CSES - Datatähti 2018 alku - Results
Submission details
Task:Merkkijono
Sender:Ilmari2000
Submission time:2017-10-12 20:00:18 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.06 sdetails
#2ACCEPTED0.07 sdetails
#3ACCEPTED0.06 sdetails
#40.06 sdetails
#50.06 sdetails
#6ACCEPTED0.06 sdetails
#7ACCEPTED0.04 sdetails
#8ACCEPTED0.07 sdetails
#90.06 sdetails
#10ACCEPTED0.06 sdetails

Code

#include <iostream>
#include <string>
#include <cctype>
#include <algorithm>

int main(int argc, char* argv[])
{
	std::string str;
	std::cin >> str;
	int loop = 1;
//	std::locale loc("en-US");
//	#include <algorithm>
	for(unsigned int i = 0; i < str.length(); i++)
		if(!isalpha(str[i]))
		{
			str.erase(i, 1);
			i--;
		}

	while(loop)
	{
		loop = 0;
		for(unsigned int i = 0; i < str.length(); i++)
		{
			char current = toupper(str[i]);

			int j;
			for(j = 0; toupper(str[i + j]) == current; j++);
			if(j > 1)
			{
				str.erase(i, j);
				loop = 1;
			}
		}
	}

	std::cout << str << std::endl;
}

Test details

Test 1

Verdict: ACCEPTED

input
ABABABABABABABABABABABABABABAB...

correct output
ABABABABABABABABABABABABABABAB...

user output
ABABABABABABABABABABABABABABAB...

Test 2

Verdict: ACCEPTED

input
AABBAABBAABBAABBAABBAABBAABBAA...

correct output
(empty)

user output
(empty)

Test 3

Verdict: ACCEPTED

input
ABABABABABABABABABABABABABABAB...

correct output
(empty)

user output
(empty)

Test 4

Verdict:

input
BBABABBBBBAABBBABABABBBBAAABAB...

correct output
BAB

user output
A

Test 5

Verdict:

input
ACDCBBACDBBBACAACBBDBADBAABABA...

correct output
ACDCACDADBADABACACDCADADABABCA...

user output
ACDCACDADBADABACACDCADADABABCA...

Test 6

Verdict: ACCEPTED

input
EETFHIJOGACDHMGVFJCMETMZDEITTR...

correct output
TFHIJOGACDHMGVFJCMETMZDEIROTET...

user output
TFHIJOGACDHMGVFJCMETMZDEIROTET...

Test 7

Verdict: ACCEPTED

input
GOONLAHLYPRFCZKIKSJWAWWYJJPCDB...

correct output
GNLAHLYPRFCZKIKSJWAYPCDNWYMRCE...

user output
GNLAHLYPRFCZKIKSJWAYPCDNWYMRCE...

Test 8

Verdict: ACCEPTED

input
PISHWMOTCDDZFRMYMOMYDYYGJZIQHS...

correct output
PISHWMOTCZFRMYMOMYDGJZIQHSVAOK...

user output
PISHWMOTCZFRMYMOMYDGJZIQHSVAOK...

Test 9

Verdict:

input
QUVVTPXAMWWODFXRONJODPGBTCISGM...

correct output
QUTPXAMODFXRONJODPGBTCISGMVRBW...

user output
QUTPXAMODFXRONJODPGBTCISGMVRBW...

Test 10

Verdict: ACCEPTED

input
POXHAHYEZTLYNFSLABODMRNKDSKROZ...

correct output
POXHAHYEZTLYNFSLABODMRNKDSKROZ...

user output
POXHAHYEZTLYNFSLABODMRNKDSKROZ...