C++ Best Solution||Easy to Understand
```\nclass Solution {\npublic:\n    int longestBeautifulSubstring(string w) \n    {\n        int len=1,cnt=1,max_len=0;\n        for(int i=1;iw[i-1])\n         
```\nclass Solution {\npublic:\n    int longestBeautifulSubstring(string w) \n    {\n        int len=1,cnt=1,max_len=0;\n        for(int i=1;i<w.size();i++)\n        {\n            if(w[i]==w[i-1])\n            {\n                len++;\n            }\n            else if(w[i]>w[i-1])\n            {\n                len++;\n                cnt++;\n            }\n            else\n            {\n                len=1;\n                cnt=1;\n            }\n            if(cnt==5)\n            {\n                max_len=max(len,max_len);\n            }\n        }\n        return max_len;\n        \n    }\n};\n//if you like the solution plz upvote.
['C']