#C4662. Caesar Cipher Encoder
Caesar Cipher Encoder
Caesar Cipher Encoder
This problem requires you to implement a Caesar cipher encoder. Given a message and an integer shift, you must encode the message by shifting each alphabetic character by the specified number of positions in the circular alphabet. Non-alphabetical characters (such as punctuation, spaces, etc.) should remain unchanged.
In mathematical terms, for any letter \( c \) in the message, if \( c \) is a lowercase letter, it should be transformed to \( c' \) such that:
\[ c' = \text{chr}(((\text{ord}(c) - \text{ord}('a') + \text{shift}) \mod 26) + \text{ord}('a')) \]
The similar formula holds for uppercase letters with \( 'A' \). Your program must read the input from standard input (stdin) and print the encoded message to standard output (stdout).
inputFormat
The input consists of two lines:
- The first line contains the string message to encode.
- The second line contains an integer representing the shift value.
outputFormat
Output the encoded message as a single line to standard output.
## sampleHello, World!
3
Khoor, Zruog!