Simple C++ Solution
\nclass Solution {\npublic:\n    int longestBeautifulSubstring(string word)\n    {\n        int maxi=0;\n        for(int i=0;i<word.length();)\n        {\n     
```\nclass Solution {\npublic:\n    int longestBeautifulSubstring(string word)\n    {\n        int maxi=0;\n        for(int i=0;i<word.length();)\n        {\n            int a=0,e=0,ii=0,o=0,u=0;\n            while(i<word.length())\n            {\n                if(word[i]!=\'a\')\n                {\n                    break;\n                }\n                a++;\n                i++;\n            }\n            while(i<word.length())\n            {\n                if(word[i]!=\'e\')\n                {\n                    break;\n                }\n                e++;\n                i++;\n            }\n            while(i<word.length())\n            {\n                if(word[i]!=\'i\')\n                {\n                    break;\n                }\n                ii++;\n                i++;\n            }\n            while(i<word.length())\n            {\n                if(word[i]!=\'o\')\n                {\n                    break;\n                }\n                o++;\n                i++;\n            }\n            while(i<word.length())\n            {\n                if(word[i]!=\'u\')\n                {\n                    break;\n                }\n                u++;\n                i++;\n            }\n            if(a>0&&e>0&&ii>0&&o>0&&u>0)\n            {\n                maxi=max(maxi,a+e+ii+o+u);\n            }\n        }\n        return maxi;\n    }\n};\n```
[]