#C7148. Alphabet Shift
Alphabet Shift
Alphabet Shift
You are given a string consisting of characters. Your task is to shift every lowercase English letter to its next letter in the alphabet. Characters that are not lowercase letters should remain unchanged. When the letter 'z' appears it should wrap around to 'a'.
For instance, if you are given the string abc
, the output should be bcd
and if the input is xyz
then the output becomes yza
. The operation should preserve non-letter characters. This problem requires a careful implementation of character manipulation.
The transformation can be mathematically represented as: $$c' = \begin{cases} (c - 'a' + 1) \mod 26 + 'a' & \text{if } c \in [a,z] \\ c & \text{otherwise} \end{cases}$$ where \( c \) is the input character and \( c' \) is the shifted character.
inputFormat
The input is provided from stdin as a single line string. The string may contain lowercase letters along with other characters.
Examples:
abc
xyz
a1b2c3
outputFormat
The output is printed to stdout as a single line string, representing the transformed string after shifting each of the lowercase letters.
Examples:
- Input:
abc
→ Output:bcd
- Input:
xyz
→ Output:yza
abc
bcd