Julius Caesar protected his confidential information by encrypting it in a cipher. Caesar’s cipher rotated every letter in a string by a fixed number,, making it unreadable by his enemies. Given a string, , and a number, , encrypt and print the resulting string.
Note: The cipher only encrypts letters; symbols, such as
-, remain non-encrypted.
The first line contains an integer,
The second line contains the non-encrypted string, .
The third line contains the integer encryption key, , which is the number of letters to rotate.
is a valid ASCII string and doesn’t contain any spaces.
For each test case, print the encoded string.
11 middle-Outz 2
Each non-encrypted letter is replaced with the letter occurringspaces after it when listed alphabetically. Think of the alphabet as being both case-sensitive and circular; if rotates past the end of the alphabet, it loops back to the beginning (i.e.: the letter after is , and the letter after is ).
(ASCII 109) becomes (ASCII 111).
(ASCII 105) becomes (ASCII 107).
remains the same, as symbols are not encoded.
(ASCII 79) becomes (ASCII 81).
(ASCII 122) becomes (ASCII 98); because is the last letter of the alphabet,
(ASCII 97) is the next letter after it in lower-case rotation.