#C1572. Palindromic Strings

    ID: 44792 Type: Default 1000ms 256MiB

Palindromic Strings

Palindromic Strings

You are given a string. Your task is to determine whether the given string is a palindrome after removing all non-alphanumeric characters and ignoring cases.

An empty string is considered a valid palindrome. You need to process multiple test cases.

For example, the string "A man, a plan, a canal: Panama" becomes "amanaplanacanalpanama" which is a palindrome.

Note: The palindrome check should be case-insensitive and ignore any punctuation or spaces.

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 spaces, punctuation, and digits.

Input is read from standard input (stdin).

outputFormat

For each test case, output a single line containing YES if the processed string is a palindrome, or NO otherwise.

Output is written to standard output (stdout).

## sample
3
A man, a plan, a canal: Panama
race a car
Madam In Eden, I'm Adam
YES

NO YES

</p>