Easy C++ Soln || Sliding Window
\nclass Solution {\npublic:\n    int longestBeautifulSubstring(string w) {\n        unordered_map<char,int> mp;\n        unordered_map<int,int> cnt;\n        mp
```\nclass Solution {\npublic:\n    int longestBeautifulSubstring(string w) {\n        unordered_map<char,int> mp;\n        unordered_map<int,int> cnt;\n        mp[\'a\']=0;mp[\'e\']=1;mp[\'i\']=2;mp[\'o\']=3;mp[\'u\']=4;\n        int i=0,j=0,n=w.length(),ans=0;\n        while(i<n){\n            int x=mp[w[i]];\n            for(int k=x+1;k<5;k++){\n                while(j<n && cnt.count(k) && cnt[k]>0){\n                    cnt[mp[w[j]]]--;\n                    if(cnt[mp[w[j]]]==0)cnt.erase(mp[w[j]]);\n                    j++;\n                }\n            }\n            cnt[x]++;\n            if(cnt.size()==5)ans=max(ans,i-j+1);\n            i++;\n        }\n        return ans;\n    }\n};\n```
['C', 'Sliding Window']