Caesar cipher is an ancient way to encrypt messages in order for secure transmissions. It is
named after Julius Caesar who used it to protect messages of military significance. It encrypts a message
by replacing each alphabet by another one to its left or right by N with a wrap-around, where, in English,
−26 < N < 26. For example, if N = 3, the message “a” will be encrypted as “d” (alphabet “a” is replaced
with “d” because in this case every alphabet will be replaced by the one next to its right 3 positions).
The message “x” will be encrypted as “a” (since “a” is the 3rd alphabet next to the right of “x” with
wrap-around). The message “hello world” will be encrypted as “khoor zruog”. If N is a negative number,
alphabets will be replaces by ones to its left hand side.
Write a program that receives N and a message alphabet by alphabet then output the encrypted text. If
an alphabet is a space, the program ignores and bypasses it to the output. The end of a message is indicated
by the character “$”. It should also check the validity of N and alphabets, i.e., −26 < N < 26 and all
alphabets in the message must only be within the range [a-z] and [A-Z]. Special characters are not allowed.