Decoder

Interview

Time limit1sMemory limit128 MB

Summary
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 nn-th letter, where nn 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 nn. It is followed by nn words that make up the coded message.

Output

Print the decoded message on a single line.

Examples3

  1. Example 1

    Input
    10
    Give Solo a total Naboo map DEV reject bateau German
    
    Expected output
    Go to Vjun
    
  2. Example 2

    Input
    2
    A Tree
    
    Expected output
    AT
    
  3. Example 3

    Input
    5
    Some one too a sas
    
    Expected output
    S o s