#K33662. Valid Palindrome Checker
Valid Palindrome Checker
Valid Palindrome Checker
Given a string, determine whether it is a valid palindrome by considering only alphanumeric characters and ignoring case differences. After filtering out unwanted characters, the string should read the same backward as forward.
Your task is to read multiple test cases from standard input. For each test case, output "YES" if the string is a valid palindrome and "NO" otherwise.
Note: An empty string, or a string with only non-alphanumeric characters, is considered a valid palindrome.
inputFormat
The first line of input contains an integer T (1 ≤ T ≤ 100) representing the number of test cases. Each of the following T lines contains a string to be checked. The string may include spaces, punctuation, and special characters.
outputFormat
For each test case, output a single line containing "YES" if the corresponding string is a valid palindrome, or "NO" otherwise.
## sample3
A man, a plan, a canal: Panama
race a car
No 'x' in Nixon
YES
NO
YES
</p>