#K45562. Shift String by k Positions

    ID: 27781 Type: Default 1000ms 256MiB

Shift String by k Positions

Shift String by k Positions

You are given a string s consisting of lowercase English letters and an integer k. Your task is to shift every character in the string by k positions in the English alphabet. The shifting follows cyclic order: if the shift of a character exceeds 'z', it wraps around to the beginning of the alphabet (i.e. to 'a').

For example, shifting the character 'z' by 1 results in 'a', and shifting 'xyz' by 3 produces 'abc'. This operation can be formally written in LaTeX as follows:

$$ c' = \text{chr}\left(\left(\,\text{ord}(c)-\text{ord}('a') + k\,\right) \bmod 26 + \text{ord}('a')\right) $$

Your task is to implement this string transformation.

inputFormat

The input is provided via standard input (stdin). The first line contains a non-empty string s consisting of lowercase English letters. The second line contains an integer k (0 ≤ k ≤ 10^9) representing the number of positions to shift each character.

outputFormat

Output the resulting string after shifting every character in the input string by k positions, printed to standard output (stdout).## sample

xyz
3
abc