#K5781. Palindromic Permutation

    ID: 30503 Type: Default 1000ms 256MiB

Palindromic Permutation

Palindromic Permutation

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

A string can be rearranged to form a palindrome if and only if at most one character has an odd frequency. In other words, if the length of the string is even, every character must appear an even number of times; if the length is odd, then exactly one character is allowed to have an odd frequency.

For example, the string "aabb" can be rearranged into "abba" (a palindrome), whereas the string "aaab" cannot be rearranged into any palindrome.

Note: Use standard input (stdin) for input and standard output (stdout) for output.

inputFormat

The input is provided through standard input (stdin) and consists of a single line containing the string, which includes only lowercase English letters.

Example:

aabb

outputFormat

Output a single line to standard output (stdout) containing either "YES" if any permutation of the string can form a palindrome, or "NO" otherwise.

Example:

YES
## sample
aabb
YES