#C3482. Palindrome Permutation Checker
Palindrome Permutation Checker
Palindrome Permutation Checker
Given a list of words, determine if each word can be rearranged to form a palindrome.
A word can be rearranged to form a palindrome if and only if the number of characters that appear an odd number of times is at most one. In other words, for a word w with character frequency counts \(f(c)\) for each character \(c\), it is possible to form a palindrome if:
\[ \text{Number of } c \text{ such that } f(c) \mod 2 \neq 0 \le 1 \]The input is case-sensitive.
inputFormat
The input is read from standard input (stdin) and has the following format:
T word_1 word_2 ... word_T
Here, T
is an integer representing the number of words. Each of the following T
lines contains a single word composed of ASCII characters. Note that words are case-sensitive and may be empty.
outputFormat
For each word, output YES
in a new line if the letters of the word can be rearranged to form a palindrome, or NO
otherwise.
3
civic
ivicc
hello
YES
YES
NO
</p>