#C2508. Badge Sequence Validation

    ID: 45832 Type: Default 1000ms 256MiB

Badge Sequence Validation

Badge Sequence Validation

You are given a string representing a badge sequence. The sequence is considered valid if every character appears an even number of times, except for at most one character which may appear an odd number of times.

Formally, let \(f(c)\) denote the frequency of character \(c\) in the string. The sequence is valid if and only if the number of characters for which \(f(c) \equiv 1 \pmod{2}\) is less than or equal to 1.

For example:

  • For the input "civic", the output is "YES" because only one character (v) appears an odd number of times.
  • For the input "code", the output is "NO" because more than one character appears an odd number of times.

Your task is to read the input from standard input (stdin) and output the result to standard output (stdout).

inputFormat

A single line containing the string representing the badge sequence. The string may be empty.

outputFormat

A single line: "YES" if the sequence is valid according to the criteria, or "NO" otherwise.

## sample
civic
YES