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.
Input
The input consists of one string
Output
Output one string
Sample Input 1 | Sample Output 1 |
---|---|
hellohrllohello |
hello |
Sample Input 2 | Sample Output 2 |
---|---|
hejhejhej |
hej |