easy to understand c++ solution
\n int longestBeautifulSubstring(string word) {\n // please do a dry run on this example "aeiaaioaaaaeiiiiouuuooaauuaeiu"\n// you will understand it better.\n  
```\n int longestBeautifulSubstring(string word) {\n // please do a dry run on this example "aeiaaioaaaaeiiiiouuuooaauuaeiu"\n// you will understand it better.\n        int i=0,j=0;// two pointers\n        int maxlen=0;\n        char curr=word[0];// we will use it check that next vowel appeared should be greated than curr\n        \n        int appeared=1;// counter for number of distinct vowels appeared till now\n        while(i<word.size() && j<word.size()){\n            if(word[i]==\'a\' || word[i]==\'e\' || word[i]==\'i\' || word[i]==\'o\' || word[i]==\'u\'){\n              \n                if(curr> word[i]){// when sorted order gets interrupted\n                     \n               if(appeared==5)     maxlen=max(maxlen,i-j);// if all five vowels appeared\n                    j=i;\n                    appeared=1;\n                    curr=word[i];\n                    \n                }\n                else {\n                 \n                    if(curr != word[i]) appeared++;// counting distinct vowels in window\n                    curr=word[i];\n                    i++;\n                }\n                \n            }\n            else i++;\n        }\n        if(appeared==5) maxlen=max(maxlen,i-j);\n        return maxlen;\n    }\n```
['C', 'Sliding Window', 'C++']