You are the leader of a crack intelligence unit, and today your team intercepted a set of encrypted messages ('ciphertexts') from 'IndyBoy', a well known and much feared terrorist leader. It is thought that these ciphertexts contain instructions to his henchmen on which targets to attack next.

Your team knows that despite IndyBoy's sophistication, he uses a simple Caesar Cipher.

In this cipher, letters are shifted by a fixed number of positions P, where P is unknown to you. For example, if letters are shifted by P=2 positions, we get the following 'key':

Plain
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Cipher
C D E F G H I J K L M N O P Q R S T U V W X Y Z A B

So, for example, HELLO WORLD is encrypted to JGNNQ YQTNF. IndyBoy encrypts only upper-case letters.

Your team also knows that the words 'CHIPMUNKS' and 'LIVE' always appear in IndyBoy's messages, and that he uses a different key for each message. You can assume that for each message, there is exactly one key that results in the words 'CHIPMUNKS' and 'LIVE' to appear in the decrypted message. Your task is to write a program to decrypt all of IndyBoy's encrypted messages (not just the one shown above) to produce the corresponding plaintext. The fate of your nation is in your hands!

Input
This is a text file containing a single line of ciphertext consisting of at most 1,000 characters.

Output
The plaintext version of the ciphertext. The plaintext version has exactly the same characters as the ciphertext (including newlines, spaces etc), except that uppercase letters are replaced by their decrypted version.
Example


Set 1

Input


XLMW MW MRHCFSC. M EQ LIVIFC SVHIVMRK XLEX EPP QC QIR QYWX IEX TITTIVSRM TMDDEW IZIVCHEC. XLMW SVHIV AMPP FI VITIEPIH SRPC YTSR QC VIXMVIQIRX. PSRK PMZI XLI GLMTQYROW!

Output


THIS IS INDYBOY. I AM HEREBY ORDERING THAT ALL MY MEN MUST EAT PEPPERONI PIZZAS EVERYDAY. THIS ORDER WILL BE REPEALED ONLY UPON MY RETIREMENT. LONG LIVE THE CHIPMUNKS!

Recommended Answers

All 5 Replies

When we finish the assignment, should we post it here or should we submit it directly to your professor?

> should we post it here or should we submit it directly to your professor?
Nah, better to write the code, run the code through itself, then post the re-encrypted source code back here :D

LONG LIVE THE CHIPMUNKS. You will never silence the voice of freedom fighter (not terreorist) 'IndyBoy'!! :)

But seriously, who came up with this assignment???

@kuay - you missed one important rule of this forum. Read it here and after that we can proceed further with your advice

i'm sorry . i not read rule of this forum.
thank with your advice

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.