#K42322. Taco Palindrome Checker

    ID: 27062 Type: Default 1000ms 256MiB

Taco Palindrome Checker

Taco Palindrome Checker

This problem requires you to determine whether a given string is a palindrome, ignoring case and any non-alphanumeric characters. A string is considered a palindrome if, after removing all characters except letters and digits and converting them to lower-case, it reads the same forwards and backwards.

For example, the string A man, a plan, a canal, Panama! can be cleaned to amanaplanacanalpanama, which is a palindrome. Your task is to check multiple strings and output YES if the string is a palindrome and NO otherwise.

Please note: Input strings may contain spaces, punctuation, and mixed cases.

inputFormat

The input begins with an integer T denoting the number of test cases. Each of the following T lines contains a single string to be checked.

outputFormat

For each test case, output a single line containing YES if the input string is a palindrome, or NO if it is not.## sample

3
radar
A man, a plan, a canal, Panama!
hello
YES

YES NO

</p>