IPSC Logo

Internet Problem Solving Contest

IPSC 2006

Problem E – Encoded Messages

Cryptography can be divided into two major areas: pre-computer era cryptography and modern cryptography. This task deals with the former area. (Fans of modern cryptography should check out problem H instead.)

A quick survey among the IPSC organizers has shown that our most favorite "encryption" method is the following one: Take a slave, shave his head, tattoo the message, wait for the hair to grow back, and send him to the recipient. (This approach was supposedly used to warn Greece about Persian invasion plans some two millennia ago.)

Sadly, after finding out the number of registered teams, we discovered that we don't have enough slaves for all the teams. Much to our dismay, we had to choose a different encryption method to use in this task. It has something to do with permutations, but we are not telling you anything more than this.

Problem specification

Decrypt the given ciphertexts.

Input specification

The input file contains a ciphertext.

For the easy input, both the ciphertext and the plaintext you seek consist of lowercase English letters and spaces. For clarity, spaces are replaced by underscores and the ciphertext is split into 5-letter blocks.

For the hard input, both the ciphertext and the plaintext you seek consist of lowercase English letters only. (The plaintext is an English text without spaces.) For clarity, the ciphertext is split into 5-letter blocks.

Output specification

From each plaintext you should be able to determine a string that is the proof that you decrypted the text. Submit an output file containing this one string only. Write the string in ALL UPPERCASE.

Example

Input:
guvf_ vf_na _rknz cyr_p vcure
_gur_ nafjr e_lbh _er_f hccbf
rq_gb _fhoz vg_vf _gur_ fhz_b
s_sbh e_naq _frir a
Output:
ELEVEN

(The above message is encrypted by using the ROT-13 cipher: Spaces are left untouched, and the letters are cyclically shifted by 13. E.g., each 'a' is changed to a 'n', each 'b' to an 'o', etc.)


Credits:
Problemsetter(s): misof
Contest-related materials: misof, Monika