CSES - Datatähti 2018 alku - Results
Submission details
Task:Merkkijono
Sender:Katajisto
Submission time:2017-10-02 16:33:04 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1--details
#2--details
#3--details
#4--details
#5--details
#6--details
#7--details
#8--details
#9--details
#10--details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:13:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < line.length(); i++)
                                   ^
input/code.cpp:32:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int x = 0; x < line.length(); x++)
                                   ^
input/code.cpp:6:6: warning: unused variable 'erased' [-Wunused-variable]
  int erased = 0;
      ^

Code

#include <iostream>
#include <string>
using namespace std;
int main()
{
	int erased = 0;
	string back;
	string line;
	bool exist = true;
	getline(cin, line);
	while(exist == true)
	{ 
		for (int i = 0; i < line.length(); i++)
		{
			if (line[i] == line[i + 1])
			{
				if (line[i + 1] == line[i + 2])
				{
					//cout << "Erased " << i << endl;
					line.erase(i, 1);
					break;

				}
				if (line[i + 1] != line[i + 2])
				{
					//cout << "Erased " << i << " and " << i + 1 << endl;
					line.erase(i, 2);
					break;
				}
			}
		}
		for (int x = 0; x < line.length(); x++)
		{
			if (line[x] == line[x + 1])
			{
				exist = true;
				break;
			}
			exist = false;
		}
	}
	cout << line << endl;
	while(true){}
}

Test details

Test 1

Verdict:

input
ABABABABABABABABABABABABABABAB...

correct output
ABABABABABABABABABABABABABABAB...

user output
(empty)

Test 2

Verdict:

input
AABBAABBAABBAABBAABBAABBAABBAA...

correct output
(empty)

user output
(empty)

Test 3

Verdict:

input
ABABABABABABABABABABABABABABAB...

correct output
(empty)

user output
(empty)

Test 4

Verdict:

input
BBABABBBBBAABBBABABABBBBAAABAB...

correct output
BAB

user output
(empty)

Test 5

Verdict:

input
ACDCBBACDBBBACAACBBDBADBAABABA...

correct output
ACDCACDADBADABACACDCADADABABCA...

user output
(empty)

Test 6

Verdict:

input
EETFHIJOGACDHMGVFJCMETMZDEITTR...

correct output
TFHIJOGACDHMGVFJCMETMZDEIROTET...

user output
(empty)

Test 7

Verdict:

input
GOONLAHLYPRFCZKIKSJWAWWYJJPCDB...

correct output
GNLAHLYPRFCZKIKSJWAYPCDNWYMRCE...

user output
(empty)

Test 8

Verdict:

input
PISHWMOTCDDZFRMYMOMYDYYGJZIQHS...

correct output
PISHWMOTCZFRMYMOMYDGJZIQHSVAOK...

user output
(empty)

Test 9

Verdict:

input
QUVVTPXAMWWODFXRONJODPGBTCISGM...

correct output
QUTPXAMODFXRONJODPGBTCISGMVRBW...

user output
(empty)

Test 10

Verdict:

input
POXHAHYEZTLYNFSLABODMRNKDSKROZ...

correct output
POXHAHYEZTLYNFSLABODMRNKDSKROZ...

user output
(empty)