#C31. Swap Case String

    ID: 46489 Type: Default 1000ms 256MiB

Swap Case String

Swap Case String

Given a string s containing a mixture of uppercase and lowercase letters, convert each uppercase letter to its corresponding lowercase letter and each lowercase letter to its corresponding uppercase letter. Non-alphabetic characters remain unchanged.

The transformation can be formally expressed as follows:

\( T(s) = \text{for each character } c \text{ in } s:\)

  • If \( c \) is uppercase, then convert it to lowercase.
  • If \( c \) is lowercase, then convert it to uppercase.
  • Otherwise, keep \( c \) unchanged.

For example, given the string "Hello World", the output should be "hELLO wORLD".

inputFormat

The input consists of a single line containing a string.

outputFormat

Output a single line representing the modified string with swapped case.## sample

Hello World
hELLO wORLD

</p>