javascript sliding window 100ms
\nconst mx = Math.max;\nconst t = \'aeiou\';\nconst longestBeautifulSubstring = (s) => {\n    let n = s.length;\n    let res = 0;\n    for (let i = 0; i < n; i+
```\nconst mx = Math.max;\nconst t = \'aeiou\';\nconst longestBeautifulSubstring = (s) => {\n    let n = s.length;\n    let res = 0;\n    for (let i = 0; i < n; i++) {\n        if (s[i] == \'a\') { // if want the longest, so have to keep as much as "a" comes left of "eiou", so the answer should start with "a"\n            let right = i;\n            let flag = 1;\n            for (let j = 0; j < 5; j++) {\n                if (s[right] != t[j]) {\n                    flag = 0;\n                    break;\n                }\n                while (right < n && s[right] == t[j]) right++;\n            }\n            if (flag) res = mx(res, right - i);\n            i = right - 1;\n        }\n    }\n    return res;\n};\n```
['Sliding Window', 'JavaScript']