KTH Challenge 2020


2020-04-25 01:00 AKDT

KTH Challenge 2020


2020-04-25 05:00 AKDT
The end is near!
Contest is over.
Not yet started.
Contest is starting in -182 days 13:34:12

Time elapsed


Time remaining


Problem G
Triple Texting

Julia enjoys talking to her grandma, playing with legos, and inventing two-player card games where she has a winning strategy. Recently however, she has not been able to talk to her grandma in person because of some kind of “pandemonium”. Instead, they have resorted to texting, which is a very slow process since grandma types very slowly and often mistypes letters. To make matters worse, grandma has started to write every word three times so that Julia can correct her mistypes. For example, if grandma wants to write the word “hello”, she will instead write “hellohellohello”. If she mistypes one of those letters, it might instead be sent as “hellohrllohello’.’

Your task is to write a program that given a message sent by grandma, where possibly one letter has been changed to some other letter, finds the original word.


The input consists of one string $s$ containing lower case English letters ($3 \leq |s| \leq 99$). This is the message sent by grandma. It is guaranteed that this string is the result of a word being written three times, where possibly one letter was changed to some other letter.


Output one string $t$, the original word.

Sample Input 1 Sample Output 1
Sample Input 2 Sample Output 2