eolymp
bolt
Try our new interface for solving problems
Problems

Шифр

Шифр

Vasya invented his method of encryption. It consists, he follows: 1. Line of text is supplemented by the last character of the string zero or more times until the long string length will not be a square integer. Call this number \textbf{N}. 2. Then the text is transferred into the square, consisting of \textbf{N}x\textbf{N} cells. The beginning of the text is transferred into the first row of the square from left to right, the following characters - the second line, etc. 3. Once the box is full, data is read out, but not in rows, as they were entered into it, and the columns. At the beginning of the line characters are entered the first column from top to bottom, then the symbols of the second column, etc. The resultant string is the ciphertext. Help Vasya - write a program that was implemented would have invented a way to encrypt them. \InputFile In the first line of input data (ending with a newline) is the original text, composed of Latin letters. Length of the line from \textbf{0} to \textbf{25} characters. \OutputFile Remove one row - the result of encryption of a given text.
Time limit 1 second
Memory limit 64 MiB
Input example #1
EXAMPLE
Output example #1
EMEXPEALE