#K50142. Caesar Cipher Encoding

    ID: 28799 Type: Default 1000ms 256MiB

Caesar Cipher Encoding

Caesar Cipher Encoding

This problem asks you to implement a Caesar cipher encoding. Given a shift value s (with \(1 \le s \le 25\)) and a message consisting of lowercase letters and other characters, you must shift each lowercase letter in the message forward by s positions in the alphabet. Characters that are not lowercase letters should remain unchanged. Note that the cipher wraps around: after 'z' comes 'a'.

For each letter \(c\) in the message, compute its encoded form using the formula: $$new = ((\text{ord}(c)-\text{ord}('a') + s) \mod 26) + \text{ord}('a')$$ where \(\text{ord}(\cdot)\) represents the ASCII value. The input consists of multiple lines and ends when a line with a shift value of 0 is encountered.

inputFormat

The input is read from standard input and consists of multiple lines. Each non-empty line contains an integer shift value followed by a space and then the message string. The input terminates when the shift value is 0. Note that the message may include spaces and punctuation.

outputFormat

For each input line (except the termination line), output the encoded message on a new line to standard output.

## sample
3 hello world
0
khoor zruog

</p>