Decoder
InterviewTime limit1sMemory limit128 MB
Each word contributes one letter: the first letter of the first word, then the k-th letter of each word where k is the previous word's length; spaces appear when the previous word is too long.
- Level
Easy3 of 10
- Topics
- String, Implementation, Simulation, Array
- Solved
- No attempts yet
Problem
All Sith messages are sent using a complex coding scheme. You have cracked their code and must write a program to decode coded messages.
The code works as follows:
- Each word in the coded message represents one letter of the decoded message.
- For the first word, use its first letter.
- For every following word, use its -th letter, where is the length of the previous word.
- If the previous word is longer than the current word, the current word represents a space (a blank).
Input
The first line contains a positive integer . It is followed by words that make up the coded message.
Output
Print the decoded message on a single line.