This page is still under construction.

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

Vertical Reading

Interview

Time limit1sMemory limit256 MB

Summary
Read five given words column by column from top to bottom, skipping missing letters in shorter words, and print the letters in that order.
Level

Easy1 of 10

Topics
Simulation, Array, String
Solved
No attempts yet

Problem

Yeongseok cannot read yet, and he plays with a toy that sticks magnetic letters on a blackboard. The letters in the toy are the uppercase letters A to Z, the lowercase letters a to z, and the digits 0 to 9.

Yeongseok sticks letters in one horizontal row to make a word, then sticks letters in the row below it to make another word. He makes five words this way. One word is 1 to 15 letters stuck next to each other with no gap, and the five words may have different lengths.

When he gets bored, he reads the five words vertically. He first reads the first letter of every word from top to bottom, then the second letter of every word from top to bottom. He keeps moving one position to the right and reads the letters at that position from top to bottom. While he reads position ii, a word shorter than ii letters has no letter there, so he skips that word and continues with the letter of the word right below it.

Given the five words on the blackboard, write a program that prints the letters in the order Yeongseok reads them.

Input

Five lines are given. Each line holds 1 to 15 letters stuck next to each other with no gap. Each letter is an uppercase letter A to Z, a lowercase letter a to z, or a digit 0 to 9. A line has no space at its start or its end.

Output

Print the letters in the order Yeongseok reads them, joined with no spaces, on one line.

Examples2

  1. Example 1

    Input
    ABCDE
    abcde
    01234
    FGHIJ
    fghij
    
    Expected output
    Aa0FfBb1GgCc2HhDd3IiEe4Jj
    
  2. Example 2

    Input
    AABCDD
    afzz
    09121
    a8EWg6
    P5h3kx
    
    Expected output
    Aa0aPAf985Bz1EhCz2W3D1gkD6x