Interesting Correspondence
Limits: 2 sec., 256 MiB
Marichka is going to take part in “Miss High School” contest and Zenyk is helping her to prepare. Since they want to keep all things secret they decided to encrypt e-mails related to the contest.
The guys are using the following cipher: if Zenyk has a message of length \(\mathbf{N} = K \cdot K\), for example ‘123456789’, he writes it down into a K by K square in a diagonal order starting from the top left corner
124
357
689
Finally he concatenates the rows of the square and sends the message ‘124357689’ to Marichka.
Your task is to help Marichka to decode the given message.
Input
The first line contains integer N — the length of the message. The following line contains the message S Marichka has received.
Output
The original message.
Constraints
S contains only lowercase (’a’-’z’), uppercase (’A’-’Z’) English letters and digits (’0’-’9’),
\(|\mathbf{S}| = \mathbf{N}\),
\(\mathbf{N} = K^2\),
\(1 \le K \le 10\).
Samples
Input (stdin) | Output (stdout) |
---|---|
9 124357689 | 123456789 |
Submit a solution
Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
---|
Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
---|