Simple Soultion using HashMap
\n# Code\n\nclass Solution {\n    public int longestPalindrome(String[] arr) {\n        HashMap<String, Integer> map = new HashMap<>();\n        int num=0;\n   
\n# Code\n```\nclass Solution {\n    public int longestPalindrome(String[] arr) {\n        HashMap<String, Integer> map = new HashMap<>();\n        int num=0;\n        int count=0;\n        for(String s:arr){\n            String rev= s.charAt(1)+""+s.charAt(0);\n            if(map.getOrDefault(rev,0)>0){\n                num++;\n                map.put(rev,map.getOrDefault(rev,0)-1);\n                if(rev.equals(s))count--;\n            }else{\n                map.put(s,map.getOrDefault(s,0)+1);\n                if(rev.equals(s))count++;\n            }\n        }\n        return num*4+(count!=0?2:0);\n    }\n}\n```
['Array', 'Hash Table', 'String', 'Greedy', 'Java']