C++ || without Sliding window || Map
\n\npublic:\n    int longestBeautifulSubstring(string s) {\n        long long int i,j,m=0;\n        for(j=0;j<s.length();j++)\n        {\n            if(s[j]==\
```\n\n```public:\n    int longestBeautifulSubstring(string s) {\n        long long int i,j,m=0;\n        for(j=0;j<s.length();j++)\n        {\n            if(s[j]==\'a\')\n            {\n                i=j;\n                map<int,int>mp;\n                while(i<s.length()&&s[i]==\'a\')\n                {\n                    mp[0]++;\n                    i++;\n                }\n                while(i<s.length()&&s[i]==\'e\')\n                {\n                    mp[1]++;\n                    i++;\n                }\n                while(i<s.length()&&s[i]==\'i\')\n                {\n                    mp[2]++;\n                    i++;\n                }\n                while(i<s.length()&&s[i]==\'o\')\n                {\n                    mp[3]++;\n                    i++;\n                }\n                while(i<s.length()&&s[i]==\'u\')\n                {\n                    mp[4]++;\n                    i++;\n                }\n                if(mp.size()==5)\n                {\n                    m=max(i-j,m);\n                }\n                j=i-1;\n            }\n        }\n        return m;\n    }\n};
[]