text of lowercase English letters. Call a string **even** if every letter that appears in it appears the same number of times.
You may apply the following actions as many times as you like, each costing 1:
- delete any letter;
- insert any letter at any position;
- replace a letter with the **next** one in the alphabet (for example, c with d). The letter z cannot be replaced this way: the alphabet does not wrap around.
Return the smallest number of actions that makes text even.text='xxyyy' → 1
Delete one y to get "xxyy", where x and y each appear twice.
text='mmmmnn' → 1
Replace one m with the next letter, n: in "mmmnnn" both letters appear three times. One action is enough.
text='kkmm' → 0
The letters k and m already appear twice each, so nothing needs to change.
text.length ≤ 2 · 10⁴text consists of lowercase English letters onlytext='xxyyy'
1
Run checks the first 3 tests in your browser. Submit checks all 43 tests on the server, hidden ones included.