#C11015. Palindromic Rearrangement
Palindromic Rearrangement
Palindromic Rearrangement
You are given a string s
. Your task is to determine whether any permutation of the characters in s
can form a palindrome.
A palindrome is a string that reads the same forwards and backwards. For a string to be rearranged into a palindrome, it can have at most one character with an odd frequency.
For example, the string civic
is already a palindrome, and the string ivicc
can be rearranged into civic
as well. On the other hand, the string hello
cannot be rearranged to form a palindrome.
Note: An empty string is considered a palindrome.
Problem Constraints:
- 1 ≤ T ≤ 104 where T is the number of test cases.
- 1 ≤ |s| ≤ 104 where |s| is the length of the string.
inputFormat
The input is given from standard input and consists of:
- An integer
T
on the first line, the number of test cases. - T lines follow; each line contains a string
s
for which you are to determine if a palindromic rearrangement is possible.
Input is read from stdin.
outputFormat
For each test case, output a single line with the answer: Yes
if the characters of the string can be rearranged to form a palindrome, or No
otherwise.
Output should be written to stdout.
## sample3
civic
ivicc
hello
Yes
Yes
No
</p>