#K10361. Mirror String Checker

    ID: 23230 Type: Default 1000ms 256MiB

Mirror String Checker

Mirror String Checker

You are given a string and you must determine whether it is a mirror string. A mirror string is defined as a string that satisfies two conditions:

  • Every character in the string must be one of the following mirror characters: \( \{A, H, I, M, O, T, U, V, W, X, Y\} \).
  • The string must read the same forwards and backwards.

For example, the string "AHA" is a mirror string because all characters are mirror characters and "AHA" remains the same when reversed. On the contrary, "BIM" is not a mirror string because 'B' is not a mirror character and also the string does not read the same when reversed.

An empty string is considered a mirror string.

inputFormat

The first line of input contains a single integer \(T\) representing the number of test cases. Each of the following \(T\) lines contains one string \(s\), which consists of uppercase English letters.

Input Format:

T
s_1
s_2
...
s_T

outputFormat

For each test case, output a single line containing either "YES" if the string is a mirror string or "NO" otherwise.

Output Format:

result_1
result_2
...
result_T
## sample
3
AHA
BIM
YXY
YES

NO YES

</p>