Requirements
- Input: a string containing only lowercase English characters.
- A single move consists of inserting one letter or deleting one letter already in the string. An inserted letter may be any lowercase English character, including one not already present.
- Determine the fewest moves required so that every letter present in the final string has an identical occurrence count.
Examples
s = "aaccf"
return 1
Removing f leaves a:2 and c:2, so one operation is sufficient.
Notes
- Only letters present in the final string are required to have identical occurrence counts.