#P6354. [COCI 2007/2008 #3] TAJNA
[COCI 2007/2008 #3] TAJNA
Description
Use an encryption algorithm.
Let the length of the string be . Construct a matrix such that , and under the condition , make as large as possible.
Then fill the given plaintext into this 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.
bok
bok
koaski
kakosi
boudonuimilcbsai
bombonisuuladici
Hint
Explanation of Sample 3

There are characters in total. For the matrix dimensions, you can choose , , and . Since should be as large as possible, choose .
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 of the testdata, the input string contains only lowercase letters, and its length does not exceed .
Note
This problem is translated from COCI2007-2008 CONTEST #3 T3 TAJNA。
Translated by ChatGPT 5
京公网安备 11011102002149号