This page is still under construction.

Parts of this page are still being built. What you see may change.

Triple Texting

Interview

Time limit2sMemory limit512 MB

Summary
Given a string formed by writing a word three times with at most one letter changed, recover the original word.
Level

Easy2 of 10

Topics
String, Implementation
Solved
No attempts yet

Problem

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 ss containing lower case English letters (3≤∣s∣≤993 \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

Output one string tt, the original word.

Examples2

  1. Example 1

    Input
    hellohrllohello
    
    Expected output
    hello
    
  2. Example 2

    Input
    hejhejhej
    
    Expected output
    hej