Simple solution || Easy to understand || Explained !!
The idea is simple,we use two pointers to find the length of longest substring.\nInitially i=0,j=1;\n-> whenever we find word[j]<word[j-1], we check whether all
The idea is simple,we use two pointers to find the length of longest substring.\nInitially i=0,j=1;\n-> whenever we find `word[j]<word[j-1]`, we check whether all chars in `"aeiou`" present in substring `j-i`, we use map to find that.\n-> If ` m.size() ==5` then we update the `maxi` which is longest substring and update the `i = j`.\n-> If `m.size()!=5`, then the substring doesn\'t contain all chars in `"aeiou"`, we just update` i=j.`\nFinally retuen `maxi.`\n\n**DO UPVOTE if you find it helpful !!**\n```\nint longestBeautifulSubstring(string word) {\n        int maxi =0;\n        int i=0,j=1;\n        map<char,int>m;\n        m[word[0]]++;\n        while(j<word.length()){\n            if(word[j] < word[j-1]){\n                if(m.size() == 5)\n                    maxi = max(maxi, j-i);\n                i = j;\n                m.clear();\n            }\n            m[word[j]]++;\n            j++;\n        }\n        if(m.size() == 5)\n            maxi = max(maxi,j-i);\n        return maxi;\n    }\n```
['C']