All problems

Caesar Cipher

mediumPythonStringsMath

The holiday club at Riverbend Library runs a secret-message table. A child writes a message, picks a number, and every letter is moved that many places later in the alphabet — letters that run off the end of the alphabet carry on again from a. The number is whatever the child shouted out, so it is often much larger than the alphabet, and the machine is expected to cope rather than complain.

Task: Print the message with every letter moved k places later in the alphabet.

Input

Two lines. The first holds the message: between 1 and 1000 characters, all lowercase letters a to z, with no spaces or punctuation. The second holds a single integer k, where 0 ≤ k ≤ 1000.

Output

One line holding the shifted message. Letters that would run past z continue from a.

Example:

Input:
abcxyz
3

Output:
defabc

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…