P6354 [COCI 2007/2008 #3] TAJNA

Description

Use an encryption algorithm. Let the length of the string be $n$. Construct a matrix such that $r\times c=n$, and under the condition $r\le c$, make $r$ as large as possible. Then fill the given plaintext into this $r\times c$ matrix in the order from top to bottom, left to right. The ciphertext is obtained by outputting the matrix in the order from left to right, top to bottom, forming a string. Given the plaintext, output the ciphertext.

Input Format

One line with a string, representing the plaintext.

Output Format

One line with a string, representing the ciphertext.

Explanation/Hint

#### Explanation of Sample 3 ![](https://cdn.luogu.com.cn/upload/image_hosting/n13lgixw.png) There are $16$ characters in total. For the matrix dimensions, you can choose $1\times 16$, $2\times 8$, and $4\times 4$. Since $r$ should be as large as possible, choose $4\times 4$. Then fill the matrix. The result of filling is shown in the figure above. Finally, output each character from left to right, top to bottom. #### Constraints For $100\%$ of the testdata, the input string contains only lowercase letters, and its length does not exceed $100$. #### Note **This problem is translated from [COCI2007-2008](https://hsin.hr/coci/archive/2007_2008/) [CONTEST #3](https://hsin.hr/coci/archive/2007_2008/contest3_tasks.pdf) *T3 TAJNA***。 Translated by ChatGPT 5