[C++/Python/Java] Count "AAA" and "BBB"
Count "AAA" and "BBB" and compare them\n\nYou can only remove an A that is surrounded by two other A\'s.\nSo if you keep on removing valid A\'s, then the valid 
Count "AAA" and "BBB" and compare them\n\nYou can only remove an A that is surrounded by two other A\'s.\nSo if you keep on removing valid A\'s, then the valid B\'s are not affected. Same goes for all valid B\'s.\nYou just count all the valid A\'s and valid B\'s. At each turn, Alice removes a valid A and the count of all valid A\'s (countA) decreases by one. Similarly after Bob\'s turn, countB decreases by one.\nSo if countA > countB, then a turn comes when Bob has no valid B\'s to remove. So he loses and Alice wins. You return TRUE.\nElse if countA == countB, then at some point Alice has no valid A\'s to remove, So Bob wins and you return FALSE.\nElse (countA < countB), then at some point Alice has no valid A\'s to remove. So Bob wins and you return FALSE.\n\nIn either case, if countA <= countB, then you return FALSE.\nSo just return countA > countB.\n\nPS: There\'s no optimal play here. No matter what valid color a player removes at each turn, it has no effect on the outcome.\nExplanation credits : @Zombiesalad \n\n**Python:**\n```\nclass Solution:\n    def winnerOfGame(self, s: str) -> bool:\n        \n        a = b = 0\n        \n        for i in range(1,len(s)-1):\n            if s[i-1] == s[i] == s[i+1]:\n                if s[i] == \'A\':\n                    a += 1\n                else:\n                    b += 1\n                    \n        return a>b\n```\n\n\n**C++:**\n```\nclass Solution {\npublic:\n    bool winnerOfGame(string s) {\n        \n        int a = 0, b = 0;\n        \n        for(int i=1; i<s.size()-1; i++){\n            if(s[i-1] == s[i] && s[i] == s[i+1]){\n                if(s[i] == \'A\')\n                    a++;\n                else\n                    b++;\n\t\t\t}\n        }   \n                    \n        return a>b;\n    }\n};\n```\n\n\n**Java:**\n```\nclass Solution {\n    public boolean winnerOfGame(String s) {\n        \n        int a = 0, b = 0;\n        \n        for(int i=1; i<s.length()-1; i++){\n            if(s.charAt(i) == s.charAt(i-1) && s.charAt(i) == s.charAt(i+1)){\n                if(s.charAt(i) == \'A\')\n                    a++;\n                else\n                    b++;\n\t\t\t}\n        }\n                    \n        return a>b;\n    }\n}\n```\n
['C', 'Counting', 'Python', 'Java', 'Python3']