#C10179. Caesar Cipher Encryption

    ID: 39355 Type: Default 1000ms 256MiB

Caesar Cipher Encryption

Caesar Cipher Encryption

In this problem, you are given a text string and an integer shift value. You are required to encrypt the input text using the Caesar Cipher technique. In Caesar Cipher, each alphabetical character is shifted by a certain number of places in the alphabet. The encryption is defined by the formula:

$$x' = (x + \text{shift}) \mod 26$$

where \(x\) is the 0-indexed position of the letter in the alphabet (with \(A\) or \(a\) as 0). Both lowercase and uppercase letters must be shifted appropriately, while non-alphabetical characters remain unchanged.

inputFormat

The input consists of two lines. The first line contains the text to be encrypted (a string without spaces). The second line contains an integer representing the shift value.

outputFormat

Output the resulting encrypted text as a single line.## sample

HelloWorld
3
KhoorZruog