✅ | Java | -- faster than 98.38% of Java online submissions --
```\nclass Solution {\n    public int longestPalindrome(String[] words) {\n        int result = 0;\n        int[][] letterArr= new int[26][26];\n        for (in
```\nclass Solution {\n    public int longestPalindrome(String[] words) {\n        int result = 0;\n        int[][] letterArr= new int[26][26];\n        for (int i=0; i<words.length; i++) {\n            int index1 = words[i].charAt(0) - \'a\';\n            int index2 = words[i].charAt(1) - \'a\';\n            if (letterArr[index2][index1] > 0) {\n                --letterArr[index2][index1];  result += 4;\n            } else ++letterArr[index1][index2];\n        }\n        for(int i=0; i<26; i++){\n           if(letterArr[i][i]>0) return result + 2;\n        }\n        return result;\n    }\n}
['Array', 'Java']