Python | Clean Code
```\nclass Solution:\n    def longestBeautifulSubstring(self, word: str) -> int:\n        i = 0\n        j = 0\n        n = len(word)\n        maxVal = 0\n     
```\nclass Solution:\n    def longestBeautifulSubstring(self, word: str) -> int:\n        i = 0\n        j = 0\n        n = len(word)\n        maxVal = 0\n        res = set()\n        while j < n:\n            k = j\n            while k < n and word[k]==word[j]:\n                res.add(word[k])\n                k+=1\n                \n            if len(res)==5:\n                maxVal = max(maxVal,k-i)\n            \n            if k<n and word[k] < word[j]:\n                res = set()\n            \n                i = k\n            \n            j = k\n        return maxVal\n        \n\t\t
[]