Write a program that encrypts messages with the “Caesar cipher”, used by Julius Caesar to communicate with his generals. Given a constant k, each letter of the original message is replaced by the letter that is alphabetically k positions to its right (circularly, if needed). For instance, if k = 5, we must change ‘a’ by ‘f’, ‘b’ by ‘g’, …, ‘y’ by ‘d’, and ‘z’ by ‘e’.
To solve this exercise, it can be useful a function
that returns the character corresponding to c when the constant is k.
Input
Input consists of several cases. Each case begins with a natural number k > 0, followed by a text made up of only lowercase letters and separator characters, but with no spaces, and ended with a dot.
Output
For each case, print in a line the encrypted text, using uppercase letters. Replace each ‘_’ with a space, and leave unchanged the rest of separator characters.
Input
1 i_am_an_example. 22 veni,vidi,vinci. 26000031 yzznhzzn-eznczo-wjiz-yjnzaz_ypqzhv-zidozhjnn.
Output
J BN BO FYBNQMF RAJE,REZE,REJYE DEESMEES-JESHET-BONE-DOSEFE DUVEMA-ENITEMOSS