49 - ZOJ Monthly, December 2005 - 1007
Encrption mathods have historically been divided into two categories:substitution ciphers and tranposition ciphers.Transposition ciphers recorder the letters but do not disguise them.There is a common transposition cipher,the columnar transposition.The cipher is keyed by a word or phrase not containing any repeated letters.For example:
M E G A B U C K 7 4 5 1 2 8 3 6 p l e a s e t r a n s f e r o n e m i l l i o n d o l l a r s t o m y s w i s s b a n k a c c o u n t s i x t w o t w o
MEGABUCK is the key.The purpose of the key is to number the columns, column 1 being under the key letter closest to the start of the alphabet,and so on.The plaintext is written horizontally,in rows.The ciphertext is read out by columns,starting with the column whose key letter is the lowest.
The input file contains several testcases. The first line is the positive integer number n of the test cases. Then n test cases following.
Each test case is composed of the following information:
For each test case,print the plaintext computed from the ciphertext.One per line.Sample Input:
1 MEGABUCK AFLLSKSOSELAWAITOOSSCTLNMOMANTESILYNTWRNNTSOWPAEDOBUOERIRICXSample Output:
Author: JIANG, Yongli