[Java] - Easy, Compare(Count(AAA,BBB))
Idea\n-> Just count such pairs that have same neighbours!\n\nTime Complexity\n-> O(n)\n\n\nclass Solution {\n    public boolean winnerOfGame(String str) {\n    
**Idea**\n-> Just count such pairs that have same neighbours!\n\n**Time Complexity**\n-> O(n)\n\n```\nclass Solution {\n    public boolean winnerOfGame(String str) {\n        \n    \tint i,n=str.length(),a=0,b=0;\n    \tif(n<3)\n    \t\treturn false;\n    \tfor(i=1;i<n-1;i++)\n    \t{\n    \t\tif(str.charAt(i-1)==\'A\'&&str.charAt(i)==\'A\'&&str.charAt(i+1)==\'A\')\n    \t\t\ta++;\n    \t\tif(str.charAt(i-1)==\'B\'&&str.charAt(i)==\'B\'&&str.charAt(i+1)==\'B\')\n    \t\t\tb++;\n    \t}\n    \treturn a>b;\n    }\n}\n```\n\nIf you guys get it then I will be more **happy** if you **upvote** my solution!
['Java']