#C6751. Palindrome Rearrangement

    ID: 50546 Type: Default 1000ms 256MiB

Palindrome Rearrangement

Palindrome Rearrangement

Given a string s, determine if it is possible to rearrange its characters to form a palindrome.

A string can be rearranged into a palindrome if at most one character appears an odd number of times. Otherwise, it is impossible to form a palindrome.

The input will consist of multiple test cases. For each test case, output YES if the string can be rearranged into a palindrome, otherwise output NO.

Note: The solution should read input from standard input (stdin) and output the result to standard output (stdout). The first line contains an integer T representing the number of test cases, followed by T lines each containing a string.

inputFormat

The input is read from stdin. It consists of:

  1. An integer T on the first line, indicating the number of test cases.
  2. The next T lines each contain a non-empty string s.

outputFormat

For each test case, print a line containing YES if the string can be rearranged to form a palindrome, otherwise print NO.

## sample
3
abba
aabbcc
abc
YES

YES NO

</p>