#C2710. Reverse Alphabets in a String

    ID: 46057 Type: Default 1000ms 256MiB

Reverse Alphabets in a String

Reverse Alphabets in a String

Given a string (S) containing both alphabetical and special characters, your task is to reverse only the alphabetical characters while keeping all the special characters in their original positions. This means that the positions of non-alphabetical characters remain unchanged.

For example, if (S = "a,b$c"), then the output should be ("c,b$a").

Note: Any formulas are written in LaTeX format.

inputFormat

Input is given via standard input (stdin). It consists of a single line containing the string (S), which may include letters (both uppercase and lowercase) and special characters.

outputFormat

Print the modified string to standard output (stdout) after reversing only the alphabetical characters, while the positions of the special characters remain unchanged.## sample

a,b$c
c,b$a