#C4437. Can Form Palindrome

    ID: 47975 Type: Default 1000ms 256MiB

Can Form Palindrome

Can Form Palindrome

Given a string s, determine whether its characters can be rearranged to form a palindrome. A palindrome is a string that reads the same forwards and backwards. For a string to be rearranged into a palindrome, at most one character can have an odd count. This condition can be expressed using the following formula:

$$ \text{number of odd frequency characters} \le 1 $$

Your task is to process multiple test cases. For each test case, check the string and output "YES" if a palindrome arrangement is possible, otherwise output "NO".

inputFormat

The input is read from stdin and has the following format:

  • The first line contains a single integer T, the number of test cases.
  • Each of the following T lines contains a string s. The string may include letters, digits, special characters, etc.

outputFormat

For each test case, output a single line to stdout containing "YES" if the string can be rearranged into a palindrome, or "NO" otherwise.

## sample
2
aab
code
YES

NO

</p>