#C14040. Shifting Lowercase Letters in a String

    ID: 43646 Type: Default 1000ms 256MiB

Shifting Lowercase Letters in a String

Shifting Lowercase Letters in a String

Given a string s and an integer n, your task is to shift every lowercase alphabetical character in the string by n positions in the English alphabet. If shifting passes 'z', it wraps around back to 'a'. Other characters (including uppercase letters, digits, punctuation, and spaces) should remain unchanged.

The shift is cyclic, i.e., it uses modular arithmetic. For example, when n = 1 the letter 'z' becomes 'a', and when n = -1 the letter 'a' becomes 'z'.

You are required to read the input from standard input (stdin) and print the output to standard output (stdout).

Note: All formulas in the description use LaTeX formatting. In particular, the modular arithmetic involved in the character shifting is given by: $$new\_char = (char - 'a' + n)\mod 26 + 'a'$$

inputFormat

The input consists of two lines:

  1. The first line contains the string s (which may contain spaces, punctuation, and other characters).
  2. The second line contains an integer n, representing the number of positions each lowercase letter should be shifted.

Both values will be provided via standard input.

outputFormat

Output a single line containing the transformed string after shifting each lowercase alphabetical character by n positions (with wrapping around the alphabet). The result should be printed to standard output.

## sample
abc
1
bcd