Page not loading? Try clicking here.
Placeholder

#6983

Decryption 1s 1024MB

Problems

Jeong-ol is writing a letter and wants to encrypt it to prevent others from reading it.

First, write the content of the letter in a square. Then, rotate it 90 degrees clockwise. Finally, rewrite the letter in order from the first row to the last row.

For example, if the content of the letter is "RosesAreRedVioletsAreBlue", the encrypted letter becomes "eedARBtVrolsiesuAoReerles".

Given the letter encrypted by Jeong-ol, write a program to find the original content.


Input

The first line contains the encrypted letter. The letter consists only of lowercase and uppercase English letters, its length is greater than or equal to 1 and less than or equal to 10,000, and it is always a perfect square.


Output

Output the original message of the given encrypted letter.


Example #1

RSTEEOTCP
TOPSECRET

Example #2

eedARBtVrolsiesuAoReerles
RosesAreRedVioletsAreBlue

Example #3

EarSvyeqeBsuneMa
SquaresMayBeEven


Source

BAPC 2012 E번
You must sign in to write code.