#K77107. Decoding Secret Messages

    ID: 34791 Type: Default 1000ms 256MiB

Decoding Secret Messages

Decoding Secret Messages

Jack has intercepted several secret messages which have been scrambled with special characters. His task is to decode each message by performing two steps:

  • Remove all the non-alphabetical characters. In other words, retain only the characters c where \(c\) satisfies \(\mathtt{isalpha(c)}\).
  • Reverse the order of the remaining characters.

For example, if the input string is h!e@l#l$o, after removing special characters it becomes hello, and reversing it gives olleh.

You are given multiple test cases. For each test case, process the string as described above and output the decoded message on a separate line.

inputFormat

The first line of input contains an integer \(T\), representing the number of test cases. Each of the following \(T\) lines contains a string \(S\) which may include letters, digits, and special characters.

outputFormat

For each test case, output a single line containing the decoded message obtained by removing all non-alphabetical characters from \(S\) and then reversing the order of the remaining characters.

## sample
1
h!e@l#l$o
olleh

</p>