#C8343. Forming a Palindrome
Forming a Palindrome
Forming a Palindrome
You are given a list of words. For each word, determine whether its characters can be rearranged to form a palindrome.
A word can be reorganized into a palindrome if and only if the number of characters that appear an odd number of times is at most one. In mathematical terms, let \( cnt(c) \) denote the frequency of character \( c \) in the word. Then the word can form a palindrome if \[ \sum_{c} \mathbf{1}(cnt(c) \bmod 2 = 1) \le 1, \] where \( \mathbf{1}(\cdot) \) is the indicator function.
The input consists of multiple test cases. For each word, output "Yes" if it can be rearranged into a palindrome and "No" otherwise. Each output should be printed on a new line.
inputFormat
The input begins with a single integer \( T \) representing the number of test cases. For each test case, the first line contains an integer \( n \), the number of words in that test case. This is followed by \( n \) lines, each containing one word.
outputFormat
For each word in the order they appear in the input, output a single line containing either "Yes" if the word's characters can be rearranged to form a palindrome, or "No" if they cannot.
## sample1
1
civic
Yes