#K7611. Palindrome Rearrangement
Palindrome Rearrangement
Palindrome Rearrangement
Given a string s
, determine whether any permutation of s
can form a palindrome. A palindrome is a word that reads the same backward as forward. In other words, a string can be rearranged to form a palindrome if and only if the number of characters with an odd frequency is at most one, i.e., \(odd\_count \leq 1\).
You are required to process multiple test cases. For each test case, output "YES" if the string can be rearranged into a palindrome, otherwise output "NO".
inputFormat
The first line contains an integer T
representing the number of test cases. Each of the following T
lines contains a single string s
.
Example:
3 civic ivicc hello
outputFormat
For each test case, output one line containing either "YES" if the string can be rearranged to form a palindrome or "NO" otherwise.
Example:
YES YES NO## sample
3
civic
ivicc
hello
YES
YES
NO
</p>