#C14376. Palindromic Strings
Palindromic Strings
Palindromic Strings
In this problem, you are given T strings. For each string, determine whether it is a palindrome when ignoring spaces, punctuation, and letter case. A string is considered a palindrome if, after removing all non-alphanumeric characters and converting all letters to lowercase, it reads the same forwards and backwards. Mathematically, for a string ( s ), if we define the cleaned string ( s' ) as [ s' = \text{lowercase}({ c \in s : c \text{ is alphanumeric} }) ] then the string is a palindrome if ( s' = \text{reverse}(s') ). For example, the string A man, a plan, a canal, Panama is a palindrome.
inputFormat
The input is given via standard input (stdin). The first line contains an integer ( T ) representing the number of test cases. Each of the following ( T ) lines contains a string. The string may include spaces, punctuation, and digits.
outputFormat
For each test case, output a single line to standard output (stdout) containing yes
if the given string is a palindrome after cleaning, or no
otherwise.## sample
4
A man, a plan, a canal, Panama
racecar
Hello, World!
yes
yes
no
yes
</p>