CSES - Datatähti 2018 alku - Results
Submission details
Task:Merkkijono
Sender:10GOTO10
Submission time:2017-10-03 21:31:30 +0300
Language:Java
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.16 sdetails
#20.16 sdetails
#3ACCEPTED0.19 sdetails
#40.15 sdetails
#5ACCEPTED0.15 sdetails
#6ACCEPTED0.17 sdetails
#7ACCEPTED0.15 sdetails
#8ACCEPTED0.18 sdetails
#9ACCEPTED0.16 sdetails
#10ACCEPTED0.16 sdetails

Code

import java.util.*;
 
class merkkijono
{
	static boolean del = false;
	static boolean done = false;
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scanner = new Scanner(System.in);
		String input = scanner.next();
		StringBuilder builder = new StringBuilder(input);
		while(!done){
			done = true;
			for(int i=0; i < builder.length()-1; i++) {
				while(i+1<builder.length() && builder.charAt(i)==builder.charAt(i+1)){
					builder.deleteCharAt(i+1);
					del = true;
					done = false;
				}
				if(del){
					builder.deleteCharAt(i);
					del = false;
					i=0;
				}
			}
		}
		System.out.println(builder.toString());
	}
}

Test details

Test 1

Verdict: ACCEPTED

input
ABABABABABABABABABABABABABABAB...

correct output
ABABABABABABABABABABABABABABAB...

user output
ABABABABABABABABABABABABABABAB...

Test 2

Verdict:

input
AABBAABBAABBAABBAABBAABBAABBAA...

correct output
(empty)

user output
B

Test 3

Verdict: ACCEPTED

input
ABABABABABABABABABABABABABABAB...

correct output
(empty)

user output
(empty)

Test 4

Verdict:

input
BBABABBBBBAABBBABABABBBBAAABAB...

correct output
BAB

user output
ABAB

Test 5

Verdict: ACCEPTED

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: ACCEPTED

input
QUVVTPXAMWWODFXRONJODPGBTCISGM...

correct output
QUTPXAMODFXRONJODPGBTCISGMVRBW...

user output
QUTPXAMODFXRONJODPGBTCISGMVRBW...

Test 10

Verdict: ACCEPTED

input
POXHAHYEZTLYNFSLABODMRNKDSKROZ...

correct output
POXHAHYEZTLYNFSLABODMRNKDSKROZ...

user output
POXHAHYEZTLYNFSLABODMRNKDSKROZ...