#K37657. Shift String

    ID: 26025 Type: Default 1000ms 256MiB

Shift String

Shift String

Given a string s that contains alphabetic characters (both uppercase and lowercase) and possibly other characters, your task is to output a new string in which each alphabetic character has been replaced by the next character in the alphabet. For example, 'a' becomes 'b', 'b' becomes 'c', and so on. Note that when the character is 'z' or 'Z', it wraps around to 'a' or 'A' respectively.

The transformation can be formalized as follows:

$$\text{shift}(c) = \begin{cases} \text{chr}(\text{ord}(c) + 1) & \text{if } c \neq 'z' \text{ and } c \neq 'Z' \\ 'a' & \text{if } c = 'z' \\ 'A' & \text{if } c = 'Z' \\ \end{cases} $$

Non-alphabetic characters (including spaces, digits, punctuation, etc.) should remain unchanged.

Example:

  • Input: hello world
  • Output: ifmmp xpsme

inputFormat

The input consists of a single line string s provided via standard input (stdin).

Constraints:

  • s can contain spaces, digits, punctuation, and alphabetic characters.

outputFormat

Output the transformed string to the standard output (stdout) after shifting each alphabetic character as described.

## sample
hello world
ifmmp xpsme