#C11369. Caesar Cipher Encryption
Caesar Cipher Encryption
Caesar Cipher Encryption
Given a string S and an integer shift value k, implement the Caesar Cipher encryption technique. In this technique, every alphabetical character in S is shifted by k positions in the alphabet. The operation is performed modulo 26. In other words, for any letter the new letter is calculated as follows:
[ \text{New Character} = \text{Base} + ((\text{Current Character} - \text{Base} + k) \mod 26), ]
where ( \text{Base} ) is either the ASCII value of 'a' (for lowercase letters) or 'A' (for uppercase letters). Non-alphabetical characters remain unchanged.
Note that k can be positive, negative, or even larger than 26. Your program should read the input from standard input (stdin) and print the encrypted string to standard output (stdout).
inputFormat
The input consists of two lines:
- The first line contains the string S to be encrypted. S may include spaces and special characters.
- The second line contains an integer k, representing the shift value.
outputFormat
Output the encrypted string on a single line. The output should be printed to standard output (stdout).
## sampleHELLO
1
IFMMP