100% and 78% beats | Java Solution
\nclass Solution \n{\n    public int maximumNumberOfStringPairs(String[] words) \n    {\n        // creating a dic for each unique pair(26 * 26)\n        boolea
```\nclass Solution \n{\n    public int maximumNumberOfStringPairs(String[] words) \n    {\n        // creating a dic for each unique pair(26 * 26)\n        boolean[] dictionary = new boolean[676];\n        int count = 0;\n\n        for (String w : words) \n        {\n            // current word index\n            int pairIndex1 = w.charAt(0) - \'a\' + (w.charAt(1) - \'a\') * 26;\n            // reversed word index\n            int pairIndex2 = w.charAt(1) - \'a\' + (w.charAt(0) - \'a\') * 26;\n\n            // checking if reversed word already encountered before or not?\n            count += dictionary[pairIndex2] ? 1 : 0;\n            // encountering current word\n            dictionary[pairIndex1] = true;\n        }\n\n        return count;\n    }\n}\n```
['Java']