#C13081. Reverse Non-Palindromic Strings
Reverse Non-Palindromic Strings
Reverse Non-Palindromic Strings
You are given a list of strings. For each string, if it is not a palindrome then output its reversed version; otherwise, output the original string unchanged. A string is considered a palindrome if it reads the same forwards and backwards, i.e. (s = s^{\text{reversed}}). Your solution should be efficient and able to handle large inputs.
inputFormat
The input is read from standard input (stdin). The first line contains an integer (n) representing the number of strings. Each of the following (n) lines contains a single string.
outputFormat
Print (n) lines to standard output (stdout). For each string, if the string is a palindrome, print it as is; otherwise, print its reversed version.## sample
5
radar
hello
level
world
deified
radar
olleh
level
dlrow
deified
</p>