All problems

Problem 340

Caesar Cipher

Easy · 10 pts · String, Math

Problem

The Caesar cipher hides a message by shifting every letter K places forward in the alphabet, wrapping around from z back to a. For example, with K = 3, 'a' becomes 'd' and 'y' becomes 'b'. Uppercase letters stay uppercase and lowercase letters stay lowercase. Spaces, digits and punctuation are not changed. Encrypt the given line of text.

Input

First line: the text to encrypt. Second line: the shift K.

Output

Print the encrypted text.

Constraints

1 <= length of the text <= 100000; 0 <= K <= 1000000000

Example input

Hello, World!
3

Example output

Khoor, Zruog!

Explanation

With K = 3, 'Hello, World!' becomes 'Khoor, Zruog!': each letter moves three places forward, and the comma, space and '!' are unchanged.

Every problem here can be used in a RelayTrixCode team match. Create a room.

Previous: One Edit Away Next: Strong Number