A few solutions
Kotlin\n\nclass Solution {\n    fun longestBeautifulSubstring(s: String): Int {\n        var best = 0\n        var last = \'x\'\n        var start = 0\n        
*Kotlin*\n```\nclass Solution {\n    fun longestBeautifulSubstring(s: String): Int {\n        var best = 0\n        var last = \'x\'\n        var start = 0\n        var seen = mutableSetOf<Char>()\n        for (i in 0 until s.length) {\n            if (s[i] < last) {                       // \uD83D\uDEAB violation to lexicographically non-decreasing\n                seen.clear()\n                start = i\n            }\n            seen.add(s[i]); last = s[i]\n            if (seen.size == 5)                      // \uD83D\uDC40 all 5 vowels\n                best = Math.max(best, i - start + 1) // \uD83C\uDFAF +1 for start..i inclusive\n        }\n        return best\n    }\n}\n```\n\n*Javascript*\n```\nlet longestBeautifulSubstring = (s, start = 0, last = \'x\', seen = new Set(), best = 0) => {\n    s.split(\'\').forEach((c, i) => {\n        if (c < last)                              // \uD83D\uDEAB violation to lexicographically non-decreasing\n            seen.clear(), start = i;\n        seen.add(c), last = c;\n        if (seen.size == 5)                        // \uD83D\uDC40 all 5 vowels\n            best = Math.max(best, i - start + 1);  // \uD83C\uDFAF +1 for start..i inclusive\n    });\n    return best;\n};\n```\n\n*Python3*\n```\nclass Solution:\n    def longestBeautifulSubstring(self, s: str, last = \'x\', start = 0, best = 0) -> int:\n        seen = set()\n        for i, c in enumerate(s):\n            if c < last:                            # \uD83D\uDEAB violation to lexicographically non-decreasing\n                seen.clear()\n                start = i\n            seen.add(c)\n            last = c\n            if len(seen) == 5:                     # \uD83D\uDC40 all vowels\n                best = max(best, i - start + 1)    # \uD83C\uDFAF +1 for start..i inclusive\n        return best\n```\n\n*C++*\n```\nclass Solution {\npublic:\n    using Set = unordered_set<char>;\n    int longestBeautifulSubstring(string s, int start = 0, char last = \'x\', Set seen = {}, int best = 0) {\n        for (auto i{ 0 }; i < s.size(); ++i) {\n            if (s[i] < last)                       // \uD83D\uDEAB violation to lexicographically non-decreasing\n                seen.clear(), start = i;\n            seen.insert(s[i]), last = s[i];\n            if (seen.size() == 5)                 // \uD83D\uDC40 all vowels\n                best = max(best, i - start + 1);  // \uD83C\uDFAF +1 for start..i inclusive\n        }\n        return best;\n    }\n};\n```
[]