Bests over 98.7% users.... You can rely on this code which is self explanatory
\n\n# Code\n\n\n\nclass Solution:\n    def equalSubstring(self, s: str, t: str, maxCost: int) -> int:\n        n = len(s)\n        start = 0\n        current_co
\n\n# Code\n```\n\n\nclass Solution:\n    def equalSubstring(self, s: str, t: str, maxCost: int) -> int:\n        n = len(s)\n        start = 0\n        current_cost = 0\n        max_length = 0\n\n        for end in range(n):\n            current_cost += abs(ord(s[end]) - ord(t[end]))\n\n            while current_cost > maxCost:\n                current_cost -= abs(ord(s[start]) - ord(t[start]))\n                start += 1\n\n            max_length = max(max_length, end - start + 1)\n        \n        return max_length\n      \n```
['C', 'Python', 'Java', 'Python3']