#C14342. Shift Characters
Shift Characters
Shift Characters
You are given a string s
consisting of ASCII characters. For every alphabetical character in s
, replace it with the next character in the ASCII table. If the character is 'z'
or 'Z'
, it should wrap around to 'a'
or 'A'
, respectively. All non-alphabetical characters must remain unchanged.
The transformation can be expressed using the formula: if c
is a character such that \( \text{ord}(c) \) represents its ASCII code, then for lowercase letters:
\( c' = \begin{cases} \text{chr}(\text{ord}(c)+1) & \text{if } c \neq 'z' \\ 'a' & \text{if } c = 'z' \end{cases} \)
and similarly for uppercase letters. Your task is to implement this transformation.
inputFormat
The input consists of a single line containing the string s
.
outputFormat
Output the resulting string after replacing each alphabetical character with its successor as described.
## sampleabcdxyz
bcdeyza