CSES - Datatähti 2018 alku - Results
Submission details
Task:Merkkijono
Sender:10GOTO10
Submission time:2017-10-03 20:19:13 +0300
Language:Java
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.16 sdetails
#2ACCEPTED0.14 sdetails
#3ACCEPTED0.17 sdetails
#40.14 sdetails
#50.19 sdetails
#6ACCEPTED0.15 sdetails
#7ACCEPTED0.14 sdetails
#8ACCEPTED0.18 sdetails
#90.17 sdetails
#10ACCEPTED0.16 sdetails

Code

import java.util.*;
import java.lang.*;
import java.io.*;

public class merkkijono
{
    static int length;
    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;
                }
            }
        }
        System.out.println(builder.toString());
    }
}

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...