Java Simple
\npublic int longestBeautifulSubstring(String word) {\n\tint result = 0, currentLength = 0, vowelCount = 0;\n\tfor(int i=0;i<word.length();i++) {\n\t\tif(i!=0 &
```\npublic int longestBeautifulSubstring(String word) {\n\tint result = 0, currentLength = 0, vowelCount = 0;\n\tfor(int i=0;i<word.length();i++) {\n\t\tif(i!=0 && word.charAt(i) < word.charAt(i-1)) {\n\t\t\tvowelCount = 0;\n\t\t\tcurrentLength = 0;\n\t\t}\n\t\tcurrentLength++;\n\t\tif(i==0 || word.charAt(i) != word.charAt(i-1)) vowelCount++;\n\t\tif(vowelCount == 5) result = Math.max(result, currentLength);\n\t}\n\treturn result;\n}\n```
[]