#P1906. Caesar Cipher Decryption
Caesar Cipher Decryption
Caesar Cipher Decryption
Caesar, with the support of the Senate, uses his own cipher to encrypt messages. In this cipher, each letter of the plaintext is replaced by the letter that is t-1 positions later in the alphabet (with the alphabet considered cyclic). For example, if t = 3, then the effective shift is 2: the letter A is replaced by C, B by D, …, Y by A and Z by B.
For instance, the plaintext "I Need Soldiers" becomes the ciphertext "K Pggf Uqnfkgtu" when t = 3.
Your task is to decrypt the given ciphertext back to its original plaintext.
inputFormat
The input consists of two lines. The first line contains an integer t
, which is the parameter of Caesar's cipher. The effective shift used in the cipher is t - 1
. The second line contains the ciphertext (which may include spaces and punctuation).
outputFormat
Output the original plaintext after decrypting the ciphertext using the Caesar cipher decryption method.
sample
3
K Pggf Uqnfkgtu
I Need Soldiers