C++ Two Simple and Short Solutions, Explained
Solution I:\nWe count all the pieces that Alice and Bob can remove.\nThey can only remove the middle of three As or Bs in a row.\nSo all we need to do is count 
**Solution I:**\nWe count all the pieces that Alice and Bob can remove.\nThey can only remove the middle of three `A`s or `B`s in a row.\nSo all we need to do is count the `AAA`s and `BBB`s.\n```\nclass Solution {\npublic:\n    bool winnerOfGame(string colors) {\n        if (colors.size() < 3) return false;\n        int a = 0, b = 0;\n        for (int i = 0; i < colors.size()-2; i++) {\n            if (colors.substr(i, 3) == "AAA") a++;\n            else if (colors.substr(i, 3) == "BBB") b++;\n        }\n        return a > b;\n    }\n};\n```\n****\n**Solution II:**\nInstead of counting the sets of `AAA`s and `BBB`s, we can decrease the runtime by just checking if the previous and next letters are the same.\n```\nclass Solution {\npublic:\n    bool winnerOfGame(string colors) {\n        if (colors.size() < 3) return false;\n        int a = 0, b = 0;\n        for (int i = 1; i < colors.size()-1; i++) {\n            if (colors[i-1] == colors[i] && colors[i] == colors[i+1]) {\n                if (colors[i] == \'A\') a++;\n                else b++;\n            }\n        }\n        return a > b;\n    }\n};\n```\n**Like it? please upvote!**
['C']