#C6989. Alice Cipher
Alice Cipher
Alice Cipher
This problem requires you to implement the Alice Cipher which is a variant of the classical Caesar cipher. Given an integer shift value \( k \) and a message, your task is to shift every alphabetical character in the message by \( k \) positions in the alphabet. The cipher preserves the case of the letters and leaves non-alphabetical characters unchanged.
The transformation for an alphabetical character \( c \) is defined as:
\[ \text{new}(c) = \begin{cases} \text{chr}((\text{ord}(c) - \text{ord}('a') + k) \mod 26 + \text{ord}('a')) & \text{if } c \text{ is lowercase},\\ \text{chr}((\text{ord}(c) - \text{ord}('A') + k) \mod 26 + \text{ord}('A')) & \text{if } c \text{ is uppercase}. \end{cases} \]
For example, if \( k = 3 \) and the message is "Hello, World!", then the encoded message is "Khoor, Zruog!".
Your solution should read the input from stdin and output the result to stdout.
inputFormat
The first line of input contains a single integer \( k \) (the shift value).
The second line contains a string, representing the message to be encoded. The message may contain spaces, punctuation, and digits.
outputFormat
Output a single line containing the encoded message.
## sample3
Hello, World!
Khoor, Zruog!