All tasks
Mediumstringsmath

Caesar Cipher

Time limit 2 s · Memory 64 MBAcceptance: —Solved by: 0

Statement

The first line contains a string of lowercase Latin letters, the second line contains a shift k. Shift every letter k positions forward in the alphabet, wrapping from z back to a. Print the result.

Examples

Example 1
Input
abc
1
Output
bcd
Example 2
Input
xyz
3
Output
abc

Constraints

  • String length is between 1 and 10^5
  • 0 ≤ k ≤ 10^9
Solve this task to unlock the editorial.

AI tutor

Stuck? Get a nudge — the tutor explains the idea, it never hands you the solution.