[Python] count freq
\nclass Solution:\n    def minimumDeletions(self, word: str, k: int) -> int:\n\n        @cache\n        def dfs(left, right):\n            d = a[right] - a[left
```\nclass Solution:\n    def minimumDeletions(self, word: str, k: int) -> int:\n\n        @cache\n        def dfs(left, right):\n            d = a[right] - a[left]\n            if d <= k:\n                return 0\n\n            return min(\n                dfs(left + 1, right) + a[left],  # remove\n                dfs(left, right - 1) + d - k,    # reduce\n            )\n\n        a = sorted(Counter(word).values())\n        return dfs(0, len(a) - 1)\n```
['Python']