sliding window python
class Solution:\n    def minimumDeletions(self, word: str, k: int) -> int:\n        \n        counter=Counter(word)\n        values=sorted(counter.values())\n  
class Solution:\n    def minimumDeletions(self, word: str, k: int) -> int:\n        \n        counter=Counter(word)\n        values=sorted(counter.values())\n        i=0\n        total=0\n        ans=float("inf")\n        for j in range(len(values)):\n            while i<len(values) and values[i]-values[j]<=k:\n                total+=values[i]\n                i+=1\n           \n            ans=min(ans,len(word)-total- (values[j]+k)*(len(values)-i))\n            total-=values[j]\n            \n        return ans
[]