#K76032. Palindrome Checker

    ID: 34552 Type: Default 1000ms 256MiB

Palindrome Checker

Palindrome Checker

Problem Statement:

Given a string, determine whether it is a palindrome. A string is considered a palindrome if, after removing all non-alphanumeric characters and converting all letters to lower case, it reads the same forwards and backwards. For example, the string "A man, a plan, a canal, Panama" should be identified as a palindrome.

You are required to process multiple test cases. The input begins with an integer T, representing the number of test cases. Each of the following T lines contains a string S which may include spaces, punctuation, and mixed case letters. For each test case, print "YES" if the string is a palindrome and "NO" otherwise.

inputFormat

Input Format:

The first line of input contains an integer T, the number of test cases.
Each of the next T lines contains a string S which can include spaces, punctuation, and mixed case letters.

outputFormat

Output Format:

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

1

YES