Write a function that counts the number of anagrams in a given sorted array of words
input : ["act", "cat", "dog", "god", "tac"] Output: 2
Can someone please write java code for this ?