Easy Java solution - Beats 100%
We can use a nested for-loop to iterate through our \'words\' array and compare any two words in our array without worrying about it being counted as a duplicat
We can use a nested for-loop to iterate through our \'words\' array and compare any two words in our array without worrying about it being counted as a duplicate (because the second for loop starts at \'i+1\' to ensure it can not be compared again). \n    We can make use of String\'s charAt function to compare the characters. Since we are dealing with Strings of length 2, we can use charAt to compare the 1st character of one word with the 2nd character of the other word (We cannot use String.reverse or any similar functionality because Strings are not mutable in Java). If the comparison works, increment the pairs variable and return it at the end of the nested for loop.\n\n\n\n\n# Code\n```\nclass Solution {\n    public int maximumNumberOfStringPairs(String[] words) {\n        int pairs = 0;\n        for (int i = 0; i < words.length; i++) {\n            for (int j = i + 1; j < words.length; j++) {\n                if (words[i].charAt(0) == words[j].charAt(1) && words[i].charAt(1) == words[j].charAt(0)) {\n                    pairs++;\n                }\n            }\n        }\n        return pairs;\n    }\n}\n```
['Java']