#K15541. Rearranged Palindrome
Rearranged Palindrome
Rearranged Palindrome
Given a string s, determine whether its letters can be rearranged to form a palindrome. A string can form a palindrome if and only if at most one character appears an odd number of times. In other words, if we let \( \text{odd_count} \) denote the number of characters with an odd frequency, then the string can form a palindrome if and only if \( \text{odd_count} \leq 1 \). For example, the string "carrace" can be rearranged to form "racecar", which is a palindrome.
inputFormat
The input begins with an integer T (\(1 \leq T \leq 10^5\)) representing the number of test cases. Each of the next T lines contains a non-empty string consisting of lowercase English letters.
outputFormat
For each test case, output a single line containing YES
if the string can be rearranged to form a palindrome, and NO
otherwise.
3
carrace
daily
aabb
YES
NO
YES
</p>