#K91417. Taco String Processing

    ID: 37971 Type: Default 1000ms 256MiB

Taco String Processing

Taco String Processing

You are given an integer T and T strings. For each string, remove all non-alphabetic characters and then output the reversed version of the remaining string.

For instance, given the string He!llo, after removing non-alphabetic characters it becomes Hello, and reversing it produces olleH.

This problem tests your ability to manipulate strings and process input from standard input, making use of basic string operations. Any mathematical descriptions (if needed) can be represented in LaTeX format, e.g., for a given string ( S ), let ( S' = { c \in S \mid c \text{ is an alphabetic character} } ), then output ( \text{reverse}(S') ).

inputFormat

The first line contains an integer ( T ) representing the number of test cases. Each of the following ( T ) lines contains a string ( S ) that may include special characters.

Example Input:
3
He!llo
Wor@ld!
Codi!ng

outputFormat

Output ( T ) lines, each containing the processed string (i.e., the reversed string after removing non-alphabetic characters) corresponding to each test case.

Example Output for the sample input above:
olleH
dlroW
gnidoC## sample

1
He!llo
olleH

</p>