#C6698. Palindrome Rearrangement Check
Palindrome Rearrangement Check
Palindrome Rearrangement Check
You are given a list of strings. For each string, determine if its characters can be rearranged to form a palindrome. A string can be rearranged into a palindrome if and only if the number of characters that appear an odd number of times is at most one. Formally, given a string s, if we denote f(c) as the frequency of character c in s, then s can be rearranged into a palindrome if and only if
$$\sum_{c}\left[ f(c) \bmod 2 \neq 0 \right] \leq 1$$
For each input string, output "Yes" if a palindromic rearrangement is possible, or "No" otherwise.
Input format: The first line contains an integer n denoting the number of strings. Each of the following n lines contains one string.
Output format: Print n lines, each containing the answer for the corresponding string: "Yes" or "No".
inputFormat
The first line of input contains an integer n, the number of strings. The following n lines each contain a string consisting of lowercase or uppercase letters.
outputFormat
Output n lines. For each input string, output "Yes" if the string can be rearranged into a palindrome, and "No" otherwise.## sample
4
abba
abc
aabbcc
abcd
Yes
No
Yes
No
</p>