#C6586. Taco Palindrome Permutation

    ID: 50362 Type: Default 1000ms 256MiB

Taco Palindrome Permutation

Taco Palindrome Permutation

Given a string consisting of only lowercase letters, determine whether some permutation of the string can form a palindrome.

A palindrome is a string that reads the same forwards and backwards. For a string to be rearranged into a palindrome, it can have at most one character that appears an odd number of times. Formally, let \(f(c)\) denote the frequency of character \(c\) in the string. A string can be rearranged into a palindrome if and only if
\[ \sum_{c \in \text{alphabet}} \mathbb{1}_{\{f(c) \text{ is odd}\}} \leq 1 \]

Your task is to implement a program that reads an input string from stdin and prints YES if the string can be rearranged into a palindrome, and NO otherwise.

inputFormat

The input consists of a single line containing a non-empty string \(s\) (with length \(1 \leq |s| \leq 10^5\)) composed only of lowercase English letters.

Example Input
civic

outputFormat

Output a single line: YES if some permutation of the input string can form a palindrome, or NO otherwise.

Example Output
YES
## sample
civic
YES