Count how many times each letter appears in a string. We call the string tidy when no two different letters have the same count.
Given a string s, return the smallest number of characters you must delete from s to make it tidy.
You may delete every copy of a letter. A letter that is completely gone has no count, so it can not clash with another letter.
Examples
Example 1:
Input: s = "ssaabbbc"
Output: 2
Explanation: The counts are s = 2, a = 2, b = 3 and c = 1. Delete the only c, so it is gone. Delete one a, so its count becomes 1. The counts 3, 2 and 1 are all different. One deletion is not enough.
Example 2:
Input: s = "abcd"
Output: 3
Explanation: Every letter appears 1 time. Keep one letter, and delete the other three completely.
Example 3:
Input: s = "zzzzyyyxx"
Output: 0
Explanation: The counts are z = 4, y = 3 and x = 2. They are already different, so nothing is deleted.