Ryan wants to send a secret message to Malcolm. Faintly remembering a lesson on ciphers from 5th grade, Ryan decides he would make a Caesar Cipher. Wanting to find a faster way of encoding and decoding messages, Ryan decides to make a program to do it for him.
A Caesar Cipher is a simple substitution cipher; each letter of a given text is replaced by a letter some fixed number of positions down the alphabet. With a shift of 1, A would be replaced by B, B would become C, and so on.
A positive shift would signify a shift down the alphabet (A
-> B
, Z
-> A
), a negative shift; up the alphabet (B
-> A
, A
-> Z
).
Input Specification
The first line of input will contain the integers , the length of the string to encode, and , the amount of shifts, seperated by a space.
The next line of input will contain the message to be encoded, a string with a length of . All letters are guaranteed to be uppercase.
Output Specification
Output the shifted string in uppercase. Non-letter characters should not be changed.
Subtasks
Subtask 1 [0%]
Subtask 2 [80%]
Sample Input
47 7
HEY MALCOLM! WANNA HANG OUT AFTER SCHOOL TODAY?
Sample Output
OLF THSJVST! DHUUH OHUN VBA HMALY ZJOVVS AVKHF?
Explanation
A shift of 7 will look like this:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
H I J K L M N O P Q R S T U V W X Y Z A B C D E F G
A
would turn into H
, B
into I
, etc.
Comments