#C6311. Taco: Validate Palindromic Strings

    ID: 50058 Type: Default 1000ms 256MiB

Taco: Validate Palindromic Strings

Taco: Validate Palindromic Strings

Given an integer n and n strings, determine whether each string is a valid palindrome. A string is considered a valid palindrome if, after removing all non-alphanumeric characters and converting all letters to lowercase, it reads the same forwards and backwards. In other words, given a string \( s \), let \( f(s) \) be the string obtained by filtering out non-alphanumeric characters and converting to lowercase. The string \( s \) is a valid palindrome if \( f(s) = f(s)^{\text{rev}} \).

Your task is to process the input, check each of the given strings, and output "True" if the string is a valid palindrome or "False" otherwise.

Note: The input is processed via standard input and the output should be printed to standard output.

inputFormat

The input is given via standard input. The first line contains an integer n representing the number of test strings. Each of the following n lines contains a single string which may include spaces, punctuation, and mixed case characters.

outputFormat

For each test string, print a single line containing either "True" or "False" indicating whether that string is a valid palindrome.

## sample
3
A man, a plan, a canal, Panama!
race a car
No lemon, no melon
True

False True

</p>