#K46447. Can Form Palindrome
Can Form Palindrome
Can Form Palindrome
You are given a list of strings. For each string, determine whether its characters can be rearranged to form a palindrome. A palindrome is a word that reads the same backward as forward. A necessary and sufficient condition for a string of length \( L \) to be rearranged into a palindrome is that at most one character has an odd frequency. Formally, if \( f(c) \) denotes the frequency of a character \( c \) in the string, then the string can be rearranged into a palindrome if and only if
[ \sum_{c} [f(c) \bmod 2 \neq 0] \leq 1. ]
Your task is to check all the given strings and print YES if at least one of them can be rearranged into a palindrome, otherwise print NO.
inputFormat
The input is given via standard input (stdin). The first line contains an integer \( n \) indicating the number of strings. Each of the following \( n \) lines contains a single string.
For example:
2 carrace daily
outputFormat
Output a single line to standard output (stdout) with either YES if at least one string can be rearranged into a palindrome, or NO otherwise.
## sample1
carrace
YES
</p>