C++ | Solution code | O(n) | 696. Count Binary String
Concept used here is similar to the solution for the problem 696. Count Binary Substring\n```\nclass Solution {\npublic:\n    int longestBeautifulSubstring(stri
Concept used here is similar to the solution for the problem [696. Count Binary Substring](https://leetcode.com/problems/count-binary-substrings/)\n```\nclass Solution {\npublic:\n    int longestBeautifulSubstring(string word) {\n        vector<pair<char,int>> count;\n        \n        for(int i = 0 ; i < word.size() ; ) {\n            int haha = 0;\n            int j = i;\n            char temp = word[j];\n            while(j < word.size() && word[j] == temp) {\n                j++;\n            }\n            count.push_back(make_pair(temp, j-i));\n\n            i = j;\n        }\n        \n        int answer = 0;\n\n            \n        for(int index  = 0 ; index < count.size() ; index++) {\n            int a = index;\n            int e = index+1;\n            int i = index+2;\n            int o = index+3;\n            int u = index+4;\n\n            if(a < count.size() && count[a].first == \'a\' && e < count.size() && count[e].first == \'e\' && i < count.size() && count[i].first == \'i\' && o < count.size() && count[o].first == \'o\' && u < count.size() && count[u].first == \'u\') {\n\n                answer = max(\n                    answer, count[a].second + count[e].second + count[i].second + count[o].second + count[u].second\n                );\n            }\n            \n            \n        }\n        \n        return answer;\n        \n    }\n};
[]