#C5643. Palindrome Transformation Check

    ID: 49315 Type: Default 1000ms 256MiB

Palindrome Transformation Check

Palindrome Transformation Check

Tina has a string s composed solely of lowercase English letters. She has a unique operation where she can select any substring of s and reverse it in place. Tina wants to know if it is possible to transform the string into a palindrome using zero or more of these operations.

A palindrome is defined as a string that reads the same backwards as forwards.

Note: A string 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. Mathematically, if we let \( f(c) \) denote the frequency of character \( c \) in s, then the transformation is possible if and only if:

\[ \sum_{c \in s} \mathbf{1}_{\{f(c) \text{ is odd}\}} \leq 1 \]

inputFormat

The input consists of a single line containing a string s composed of lowercase English letters. The length of s satisfies \(1 \leq |s| \leq 100000\).

outputFormat

Output a single line containing either YES if it is possible to transform s into a palindrome using the allowed operations, or NO otherwise.

## sample
aabb
YES