#K76967. Palindromic Rearrangement
Palindromic Rearrangement
Palindromic Rearrangement
You are given a string consisting of digits. Determine if the digits in the string can be rearranged to form a palindrome. A palindrome is a string that reads the same forwards and backwards. A string can be rearranged into a palindrome if at most one digit has an odd frequency. This condition can be formulated as: $$odd\_count \le 1$$, where odd_count is the count of digits with odd occurrences.
For example, the string 112233
can be rearranged into a palindrome, whereas 123
cannot.
inputFormat
The first line of input contains an integer \(T\) representing the number of test cases. Each of the following \(T\) lines contains a string of digits.
outputFormat
For each test case, print a single line containing YES
if the digits can be rearranged to form a palindrome, and NO
otherwise.
3
112233
123
445544
YES
NO
YES
</p>