Glass Reflection
InterviewTime limit1sMemory limit2048 MB
Given a reflected string where each run of identical letters is one letter longer than in the original, output the original word.
- Level
Easy2 of 10
- Topics
- String, Implementation
- Solved
- No attempts yet
Problem
Late in the evening, you are sitting at the Funky Punk Café. You feel bored because you have not done any programming all day. You stare out of the window and notice that the text on the neon signs is reflected in a strange way: the letters partially overlap, because the window is made of double-paned glass. Could you read the sign by looking at this mangled reflection? With a sudden burst of inspiration, you grab your laptop and OCR1 camera from your bag and start programming.
1OCR = Optical Character Recognition
Your OCR camera correctly recognizes the letters in the reflection once it accounts for the mirroring, but every letter is duplicated. If the sign text contains a double (or longer) letter, the reflections partially overlap, so the reflected word has only one more letter than the original word. For example, beer is reflected as bbeeerr, and ooo is reflected as oooo. Your job is to convert the reflected word back to its original form.
Input
The input consists of one line containing a string of up to English lowercase letters (a-z), the reflected word read by the OCR camera.
Output
Output the word in its original form.