862. Unique Frequency String

0

Medium

A string s is considered good if no two different characters in s have the same frequency. Given a string s, determine the minimum number of characters that need to be deleted to make s a good string. The frequency of a character in a string is the number of times it appears in the string. For example, in the string "aab", the frequency of 'a' is 2, while the frequency of 'b' is 1.

Input Format

A single line containing a string.

Output Format

An integer representing the minimum number of deletions.

Example

Input

abbccdeeee

Output

3

Constraints

1 <= s.length <= 10^5
Loading...

View Submissions

Console