#K62682. Can Form Palindrome?
Can Form Palindrome?
Can Form Palindrome?
Given an input string s
consisting of only lowercase English letters, determine whether the characters of the string can be rearranged to form a palindrome.
A palindrome is a string that reads the same backward as forward. In order for a string to be rearranged into a palindrome, at most one character can have an odd frequency. This can be expressed mathematically as:
$$\text{Let } odd = \sum_{c \in S} [\text{freq}(c) \bmod 2 \neq 0]. \quad \text{Then, a palindrome is possible if } odd \leq 1.$$
Your task is to output "YES" if the string can be rearranged to form a palindrome, and "NO" otherwise.
inputFormat
The input consists of a single line containing a string s
(possibly empty) of lowercase English letters.
outputFormat
Output a single line containing either "YES" if the string can be rearranged into a palindrome, or "NO" if it cannot.
## sampleaabb
YES