#K33002. Mirrored String Checker

    ID: 24990 Type: Default 1000ms 256MiB

Mirrored String Checker

Mirrored String Checker

This problem requires you to determine if a given string is a mirrored string (i.e. a palindrome) when considering only alphabetic characters and ignoring case. Formally, given a string \( S \), let \( f(S) \) be the string formed by taking only the letters from \( S \) and converting them to lowercase. The string \( S \) is considered mirrored if \( f(S) = f(S)^{R} \), where \( f(S)^{R} \) is the reverse of \( f(S) \).

For example, the string "A man a plan a canal Panama" is a mirrored string because when we remove non-alphabet characters and ignore case, it reads the same forwards and backwards.

inputFormat

The input is given via standard input (stdin). The first line contains a positive integer \( T \), representing the number of test cases. Each of the following \( T \) lines contains a single string \( S \). Each string may contain spaces and other non-alphabetic characters.

outputFormat

For each test case, print a single line to standard output (stdout) containing "YES" if the string is a mirrored string, or "NO" otherwise.

## sample
3
A man a plan a canal Panama
Was it a car or a cat I saw
No lemon no melon
YES

YES YES

</p>