This page is still under construction.

Parts of this page are still being built. What you see may change.

Cipher

Interview

Time limit2sMemory limit512 MB

Summary
Decrypt a Caesar-shifted message by trying all 26 shifts and picking the one where both CHIPMUNKS and LIVE appear.
Level

Easy2 of 10

Topics
Brute force, String
Solved
No attempts yet

Problem

You lead a crack intelligence unit. Today your team intercepted a set of encrypted messages from Kojak, a well known and much feared terrorist leader. The ciphertexts are thought to carry instructions to his henchmen about which targets to attack next.

Kojak is careful about most things, but his cipher is a plain Caesar cipher. Every letter moves forward by a fixed number of positions PP, and PP is unknown to you. PP is an integer between 00 and 2525, so a message may also arrive unshifted. With P=2P = 2 the key is this:

PlainABCDEFGHIJKLMNOPQRSTUVWXYZ
CipherCDEFGHIJKLMNOPQRSTUVWXYZAB

So HELLO WORLD is encrypted to JGNNQ YQTNF. Kojak encrypts only uppercase letters and leaves lowercase letters, digits, spaces and punctuation as they are.

Your team also knows that the words CHIPMUNKS and LIVE always appear in Kojak's messages, and that he uses a different key for each message. You can assume that for each message, exactly one key makes both words appear in the decrypted text. Write a program that decrypts an intercepted message.

Input

One line holding the ciphertext. The line is at most 1,000 characters long.

Output

Print the plaintext version of the ciphertext. It consists of exactly the same characters as the ciphertext, newlines and spaces included, except that uppercase letters are replaced by their decrypted version.

Examples1

  1. Example 1

    Input
    XLMW MW OSNEO. 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!
    
    Expected output
    THIS IS KOJAK. 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!