#K41617. Caesar Cipher Encryption

    ID: 26906 Type: Default 1000ms 256MiB

Caesar Cipher Encryption

Caesar Cipher Encryption

The problem requires you to implement the classical Caesar cipher encryption algorithm. The Caesar cipher works by shifting each alphabetical character by a fixed number of positions down the alphabet. Letters should wrap around (i.e., after 'Z' comes 'A' and after 'z' comes 'a'). Non-alphabetical characters (such as punctuation, digits, and spaces) should remain unchanged.

For example, with a shift of 3, the letter 'A' becomes 'D', 'B' becomes 'E', and so on. Your task is to take an input string and an integer shift value, and then output the encrypted text accordingly.

inputFormat

The input consists of two lines. The first line contains the string to be encrypted. The second line contains an integer indicating the shift value.

outputFormat

Output the resulting ciphertext after applying the Caesar cipher to the given text.## sample

Hello, World!
3
Khoor, Zruog!