#K1131. Palindrome Permutation Check

    ID: 23440 Type: Default 1000ms 256MiB

Palindrome Permutation Check

Palindrome Permutation Check

You are given a string s consisting of lowercase English letters. Determine if any permutation of the string can form a palindrome.

A string is a palindrome if it reads the same forward and backward. A permutation of s can form a palindrome if and only if the number of characters that appear an odd number of times is no more than one. In other words, let \( f(c) \) be the frequency of character \( c \). Then, for a valid palindrome permutation, it must hold that:

[ \sum_{c \in s} [f(c) \bmod 2 \neq 0] \le 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 input is read from standard input (stdin) and has the following format:

T
s1
s2
... 
 sT

Where:

  • T denotes the number of test cases.
  • Each si is a string of lowercase English letters.

outputFormat

For each test case, print a single line containing "Yes" if the string can be permuted to form a palindrome, or "No" otherwise. The output should be written to standard output (stdout).

## sample
3
civic
ivicc
hello
Yes

Yes No

</p>