1class Solution {2public boolean winnerOfGame(String colors) {3int cntA = 0, cntB = 0;4for (int i = 1; i < colors.length() - 1; i++) {5if (colors.charAt(i) == 'A' && colors.charAt(i - 1) == 'A' && colors.charAt(i + 1) == 'A')6cntA++;7if (colors.charAt(i) == 'B' && colors.charAt(i - 1) == 'B' && colors.charAt(i + 1) == 'B')8cntB++;9}1011return cntA > cntB;12}13}