#K43317. Shifted Password Generator

    ID: 27283 Type: Default 1000ms 256MiB

Shifted Password Generator

Shifted Password Generator

You are given a password consisting of only lowercase alphabetic characters. Your task is to generate a new password by shifting every character in the password by a fixed number of positions in the alphabet. The shifting is cyclic, meaning that if the shift takes a character past 'z', it wraps around to the beginning of the alphabet.

For instance, if the current password is abc and the shift is 2, then the new password should be cde. Similarly, if the current password is xyz and the shift is 3, the output should be abc because the shifting is done modulo 26.

The mathematical formulation of the transformation for each character \(c\) is:

[ new_char = \left((\text{ord}(c)-\text{ord}('a')+\text{shift}) \mod 26\right) + \text{ord}('a') ]

Implement your solution so that it reads from stdin and writes the result to stdout.

inputFormat

The input consists of two lines:

  1. The first line contains a string current_password with only lowercase alphabetical characters.
  2. The second line contains an integer shift representing the number of positions to shift each character.

outputFormat

Output a single line containing the new password after shifting each character as described.## sample

password
1
qbttxpse