Java || Easy || Brute Force || Simple || Innovative
```\nclass Solution {\n    public String revstring(String st)\n    {\n        String rev="";\n        for(int i=st.length()-1;i>=0;i--)\n        {\n            
```\nclass Solution {\n    public String revstring(String st)\n    {\n        String rev="";\n        for(int i=st.length()-1;i>=0;i--)\n        {\n            rev+=st.charAt(i);\n        }\n        return rev;\n    }\n    public int longestPalindrome(String[] words) {\n        HashMap<String,Integer> map = new HashMap<String,Integer>();\n        int max=0;\n        for(String str:words)\n        {\n            String flipped = revstring(str);\n\t\t\t\n            if(map.containsKey(flipped))\n            {\n                max += 4; \n//why we are adding 4 -> suppose word is ab then its flipped is ba and if String[] words contains ab and ba then the length of the palindromic string will be 4 (ab......ba)\n                \n                map.put(flipped,map.get(flipped)-1);\n    //we dont know the number of times, flipped occurs in map hence reducing its count by 1, if somehow value of flipped becomes 0 in map we remove it so that it doesnt return 0 everytime\n                if(map.get(flipped)==0)\n                {\n                    map.remove(flipped);\n                }\n            }\n            else\n    //if the map doesnt contain the reverse of a word then we just add the original word in map\n            {\n                map.put(str,map.getOrDefault(str,0)+1);\n            }\n        }\n        \n        for(String s:map.keySet())\n        {\n            if(map.get(s)==1 && (s.equals(revstring(s))))\n            {\n                max+=2;\n                break;\n            }\n        }\n        return max;\n    }\n}
['String', 'Java']