My Solution, Beats 96+%
Code


# Code
```javascript []
/**
 * @param {string} word
 * @return {number}
 */
var longestBeautifulSubstring = function (word) {
    let n = word.length;
    let pntPattern = 0;
    const pattern = "aeiou";
    let longestBeautiful = 0;

    let left = 0;
    let right = 0;
    while (right < n) {
        if (pattern[pntPattern] === word[right]) {
            while (pattern[pntPattern] === word[right]) {
                if (pntPattern === 4) {
                    longestBeautiful = Math.max(longestBeautiful, right - left + 1);
                }
                right++;
            }
            pntPattern++;
        } else {
            while (right < n && "a" !== word[right]) {
                right++;
            }
            left = right;
            pntPattern = 0;
        }
    }
    return longestBeautiful;
};
```
['Sliding Window', 'JavaScript']