#K59227. Taco's Palindrome Permutation
Taco's Palindrome Permutation
Taco's Palindrome Permutation
You are given a string consisting of lowercase letters. Your task is to determine if any permutation of the string can form a palindrome.
A palindrome is a string that reads the same forward and backward. A necessary and sufficient condition for a string to be rearranged into a palindrome is that at most one character has an odd frequency count. In other words, if we let \(\text{odd_count}\) be the number of characters that appear an odd number of times, the condition is:
[ \text{odd_count} \le 1 ]
For each test case, output YES if a palindrome permutation is possible, and NO otherwise.
Note: The input is case-sensitive and, per problem constraints, all input strings are in lowercase.
inputFormat
The first line of input contains an integer T representing the number of test cases. Each of the following T lines contains a single string.
outputFormat
For each test case, output a single line with either YES
(if a palindrome permutation can be formed) or NO
(if it cannot).
3
civic
ivicc
hello
YES
YES
NO
</p>