Task: | Merkkijono |
Sender: | eetu02 |
Submission time: | 2017-10-12 15:17:48 +0300 |
Language: | Python3 |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.06 s | details |
#2 | ACCEPTED | 0.06 s | details |
#3 | ACCEPTED | 0.09 s | details |
#4 | ACCEPTED | 0.06 s | details |
#5 | ACCEPTED | 0.10 s | details |
#6 | ACCEPTED | 0.07 s | details |
#7 | ACCEPTED | 0.06 s | details |
#8 | ACCEPTED | 0.08 s | details |
#9 | ACCEPTED | 0.07 s | details |
#10 | ACCEPTED | 0.07 s | details |
Code
# -*- coding: utf-8 -*- """ Created on Thu Oct 5 15:23:24 2017 @author: eetu.pakkanen """ # DATATÄHTI ALKU 2018 --- MERKKIJONO def etsi_alku(merkkijono): for indeksi in range(len(merkkijono)-1): if merkkijono[indeksi] == merkkijono[indeksi + 1]: return indeksi return -1 def etsi_loppu(merkkijono, loppu): for indeksi in range(loppu, len(merkkijono)-1): if merkkijono[indeksi] == merkkijono[indeksi+1]: loppu = loppu+1 else: break return loppu+ 1 def delete(merkkijono): while len(merkkijono) > 0: alku = etsi_alku(merkkijono) if alku < 0: break loppu = etsi_loppu(merkkijono, alku) merkkijono = merkkijono[:alku] + merkkijono[loppu:] return merkkijono if __name__ == "__main__": print(delete(input()))
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: ACCEPTED
input |
---|
BBABABBBBBAABBBABABABBBBAAABAB... |
correct output |
---|
BAB |
user output |
---|
BAB |
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... |