word of lowercase English letters. Delete as few characters as possible so that no two **different** letters left in the string occur the same number of times.
Letters that have been removed completely are not compared.
Return the minimum number of characters to delete.word="xxyyzzz" → 1
Both x and y appear twice. Delete one y: now x — 2, y — 1, z — 3, all different.
word="abc" → 2
Every letter appears once. Only one of them can stay, so two are deleted. Letters that are gone entirely do not count.
word="mmmmn" → 0
word consists of lowercase English lettersword="xxyyzzz"
1
Run checks the first 3 tests in your browser. Submit checks all 26 tests on the server, hidden ones included.