python | easy |
\nclass Solution:\n    def equalSubstring(self, s: str, t: str, maxCost: int) -> int:\n        \n        cost=0\n        l=0\n        ans=0\n        for r in ra
```\nclass Solution:\n    def equalSubstring(self, s: str, t: str, maxCost: int) -> int:\n        \n        cost=0\n        l=0\n        ans=0\n        for r in range(len(s)):\n            \n            cost+= abs(ord(s[r])-ord(t[r]))\n            while cost > maxCost:\n                cost -= abs(ord(s[l]) - ord(t[l]))\n                l+=1\n            ans=max(ans,  r-l+1)\n        return ans\n            \n            \n        \n        \n```
['Python', 'Python3']