Cipher

Interview

Time limit2sMemory limit128 MB

Summary
Given an encrypted string built by zigzag row reading of a column-filled table, reconstruct the original string for a given number of columns.
Level

Easy3 of 10

Topics
Simulation, Matrix, String, Implementation
Solved
No attempts yet

Problem

Two people encrypt messages so that others cannot read them. The original string is first written into a table with K columns. Starting from the leftmost column, fill each column from top to bottom; after a column is full, move to the next column on the right.

If the original string is abcdefghijkl and K = 3, the table is filled as follows.

aei
bfj
cgk
dhl

Then the encrypted string is made by reading the table row by row. Read the first row from left to right, the second row from right to left, and continue alternating directions for the remaining rows. The table above produces the encrypted string aeijfbcgklhd.

Given the encrypted string and the number of columns K, restore the original string.

Input

The first line contains the number of columns K. (1 ≤ K ≤ 20)

The second line contains the encrypted string. It consists only of lowercase English letters, its length is at most 200, and its length is a multiple of K.

Output

Print the original string on one line.

Examples1

  1. Example 1

    Input
    3
    aeijfbcgklhd
    
    Expected output
    abcdefghijkl