#K89322. Rearrange Palindrome

    ID: 37505 Type: Default 1000ms 256MiB

Rearrange Palindrome

Rearrange Palindrome

You are given T test cases. In each test case, you are given a string of digits. Your task is to determine whether it is possible to rearrange the digits of the given string to form a palindrome.

A palindrome is a string that reads the same backward as forward. For a string to be rearranged into a palindrome, at most one digit may occur an odd number of times. In other words, if we define \( f(d) \) as the frequency of digit \( d \), the string can form a palindrome if:

[ \left|{ d \mid f(d) \mod 2 = 1 }\right| \le 1 ]

Output "YES" if the digits can be rearranged to form a palindrome, and "NO" otherwise.

inputFormat

The input is given via standard input (stdin) and consists of:

  1. An integer T representing the number of test cases.
  2. T lines follow, each containing a string of digits.

You need to process each test case independently.

outputFormat

For each test case, print a single line containing either "YES" if it is possible to rearrange the digits to form a palindrome, or "NO" if it is not possible. The output should be sent to standard output (stdout).

## sample
1
5
YES