#K1921. Minimum Deletions for Odd Character Counts

    ID: 24622 Type: Default 1000ms 256MiB

Minimum Deletions for Odd Character Counts

Minimum Deletions for Odd Character Counts

Given a string \( s \), determine the minimum number of deletions required so that every distinct character in \( s \) appears an odd number of times. In other words, for each character with frequency \( f \), if \( f \) is even then one deletion is required to make it odd (i.e. from \( f \) to \( f-1 \)).

For example:

  • For \( s = "aabbcc" \), the frequencies are \( a:2, b:2, c:2 \). Each count is even and one deletion per character yields a total of 3 deletions.
  • For \( s = "aaabbbccc" \), all counts are odd, so no deletion is needed.

Your task is to write a program that reads the string from standard input and outputs the minimum number of deletions required to satisfy the condition.

inputFormat

The input consists of a single line containing the string \( s \). The string may contain any printable characters and its length can be zero.

outputFormat

Output a single integer representing the minimum number of deletions required such that every character in the string appears an odd number of times.

## sample
aabbcc
3