#C9210. Palindromic Rearrangement

    ID: 53279 Type: Default 1000ms 256MiB

Palindromic Rearrangement

Palindromic Rearrangement

You are given a string. Your task is to determine whether the characters of the string can be rearranged to form a palindrome.

A palindrome is a string that reads the same forwards and backwards. A necessary and sufficient condition for the existence of a palindromic arrangement is that at most one character appears an odd number of times.

The input begins with an integer T, denoting the number of test cases. Then follows T lines, each with a string. For each test case, print "Yes" if the characters can be rearranged to form a palindrome, otherwise print "No".

Mathematically, for a string s with frequency counts \( f(c) \) for each character \( c \), the condition is: \[ \text{At most one } c \text{ such that } f(c) \equiv 1 \pmod{2}. \]

inputFormat

The first line of input contains an integer T (1 ≤ T ≤ 105) representing the number of test cases. Each of the next T lines contains a non-empty string consisting of lowercase English letters. The length of each string will not exceed 105 and the total length of all strings will not exceed 106.

outputFormat

For each test case, output a single line containing either "Yes" if the string's characters can be rearranged to form a palindrome, or "No" otherwise.

## sample
3
aabb
racecar
abcd
Yes

Yes No

</p>