Write a program that encrypts messages with the “Caesar cipher”, used
by Julius Caesar to communicate with his generals. Given a constant
,
each letter of the original message is replaced by the letter that is
alphabetically
positions to its right (circularly, if needed). For instance, if
,
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
char encoded(char c, int k);
that returns the character corresponding to @c@ when the constant is @k@.
Input consists of several cases. Each case begins with a natural number , followed by a text made up of only lowercase letters and separator characters, but with no spaces, and ended with a dot.
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