#K42527. Reverse and Swap Case

    ID: 27107 Type: Default 1000ms 256MiB

Reverse and Swap Case

Reverse and Swap Case

You are given a string S from standard input. Your task is to reverse the string and swap the case of every alphabetical character.

For example, if S = "Hello World!", after reversing and swapping the case you should output "!DLROw OLLEh". Non-alphabetical characters remain unchanged.

The transformation can be defined as follows: [ \text{output} = \text{swap_case}(\text{reverse}(S)) ]

where (\text{reverse}(S)) reverses the string and (\text{swap_case}(\cdot)) inverts the case of each letter. Solve the problem using input from standard input (stdin) and output the result to standard output (stdout).

inputFormat

The input consists of a single line containing the string S. S may include letters, digits, spaces, and punctuation.

outputFormat

Output a single line which is the reverse of S with the case of every letter swapped.## sample

Hello World!
!DLROw OLLEh