simple Java solution
\npublic int longestBeautifulSubstring(String word) {\n         int cnt = 1;\n        int len = 1;\n        int max_len = 0;\n        for (int i = 1; i != word.
```\npublic int longestBeautifulSubstring(String word) {\n         int cnt = 1;\n        int len = 1;\n        int max_len = 0;\n        for (int i = 1; i != word.length(); ++i) {\n            if (word.charAt(i - 1) == word.charAt(i)) {\n                ++len;\n            } else if (word.charAt(i - 1) < word.charAt(i)) {\n                ++len;\n                ++cnt;\n            } else {\n                cnt = 1;\n                len = 1;\n            }\n            \n            if (cnt == 5) {\n                max_len = Math.max(max_len, len);\n            }\n        }\n        return max_len;\n    }\n```
['Java']