🔥 C++ Solution || O(n) time and O(1) space || Greedy approach
\n# Code\n\nclass Solution {\npublic:\n    bool winnerOfGame(string colors) {\n        int aliceTurns = 0, bobTurns = 0;\n        int n = colors.size();\n\n    
\n# Code\n```\nclass Solution {\npublic:\n    bool winnerOfGame(string colors) {\n        int aliceTurns = 0, bobTurns = 0;\n        int n = colors.size();\n\n        for(int i=2;i<n;i++){\n            if(colors[i] == \'A\' && colors[i-1] == \'A\' && colors[i-2] == \'A\'){\n                aliceTurns++;\n            }\n            else if(colors[i] == \'B\' && colors[i-1] == \'B\' && colors[i-2] == \'B\'){\n                bobTurns++;\n            }\n        }\n\n        return aliceTurns > bobTurns;\n    }\n};\n```
['String', 'Greedy', 'C++']