SP20 CRYPTO4 - The Bytelandian Cryptographer (Act IV)

Description

The Bytelandian Cryptographer has been requested by the BBFO to put forward an encryption scheme which would allow the BBFO to communicate with its foreign associates. After some intensive studies, he has decided upon the Vigen�re cipher. Messages written using 26 upper case characters of the Latin alphabet: A, B, ..., Z which are interpreted as integers 0,1, ..., 25 respectively. The secret cypher for transmitting a message is known to both sides and consists of n integers k $ _{1} $ , k $ _{2} $ ,...,k $ _{n} $ . Using this cypher, the i-th number x $ _{i} $ of the input message x is encrypted to the form of the i-th number of the output message y, as follows: y $ _{i} $ =(x $ _{i} $ +k $ _{1+ ((i-1) mod n)} $ ) mod 26. You are trying to find out the content of a message transmitted by the BBFO. By a lucky stroke of fortune, your spies managed to intercept the message in both its plaintext and encrypted form (x and y respectively). Unfortunately, during their dramatic escape the files they were carrying where pierced by bullets and fragments of messages x and y were inadvertently lost. Or were they? It is your task to reconstruct as much of message x as you possibly can.

Input Format

N/A

Output Format

N/A

Explanation/Hint

**Warning: large Input/Output data, be careful with certain languages. The time limit is strict for this problem.**