#K90222. Encrypt a Message Using a Cyclic Caesar Cipher

    ID: 37705 Type: Default 1000ms 256MiB

Encrypt a Message Using a Cyclic Caesar Cipher

Encrypt a Message Using a Cyclic Caesar Cipher

You are given a lowercase alphabetic string s and an integer k. Your task is to encrypt the string by shifting each letter in s by k positions cyclically. That is, each letter c in the string is replaced by the letter corresponding to the formula:

\( new\_index = ( (c - 'a') + k ) \mod 26 \)

The result should be printed as a single string with all letters shifted appropriately.

Examples:

  • For s = "xyz" and k = 2, the output is zab.
  • For s = "abc" and k = 25, the output is zab.
  • For s = "zzz" and k = 2600, the output is zzz.

inputFormat

The input is read from standard input (stdin) and consists of two lines:

  • The first line contains a string s consisting of lowercase letters.
  • The second line contains an integer k.

outputFormat

The output is written to standard output (stdout) and is a single line containing the encrypted string after shifting each letter by k positions.

## sample
xyz
2
zab