Java solution. O(n)
\nclass Solution {\n    public boolean winnerOfGame(String colors) {\n        int countA = 0;\n        int countB = 0;\n\n        char[] mass = colors.toCharArr
```\nclass Solution {\n    public boolean winnerOfGame(String colors) {\n        int countA = 0;\n        int countB = 0;\n\n        char[] mass = colors.toCharArray();\n\n        for (int i = 1; i < mass.length - 1; i++) {\n            if (mass[i - 1] == \'A\' && mass[i] == \'A\' && mass[i + 1] == \'A\') {\n                countA ++;\n            }\n            if (mass[i - 1] == \'B\' && mass[i] == \'B\' && mass[i + 1] == \'B\') {\n                countB ++;\n            }\n        }\n        return countA > countB;\n    }\n}\n```
[]