#K58247. Caesar Cipher Encryption
Caesar Cipher Encryption
Caesar Cipher Encryption
You are given an integer \( k \) and a plaintext message \( s \) consisting only of uppercase letters (A-Z). Your task is to encrypt the message by shifting each letter by \( k \) positions in the alphabet using the Caesar cipher. The transformation for each letter \( c \) is given by:
\( new\_char = ((ord(c) - ord('A') + k) \mod 26) + ord('A') \)
For example, if \( k = 3 \) and \( s = "HELLO" \), the output will be "KHOOR". Note that the shift wraps around from 'Z' back to 'A'.
inputFormat
The input is read from standard input and consists of two lines:
- The first line contains an integer \( k \) (1 ≤ \( k \) ≤ 25) representing the number of positions each letter should be shifted.
- The second line contains a string \( s \) of uppercase letters ('A'-'Z').
outputFormat
Output the encrypted message to standard output. The encrypted message is a single string resulting from shifting every letter in \( s \) by \( k \) positions in the alphabet.
## sample3
HELLO
KHOOR