C++ Easy Solution using Hashmap
\nclass Solution {\npublic:\n    int longestPalindrome(vector<string>& words) {\n        int ans=0;\n        bool odd=false;\n        \n        unordered_map<st
```\nclass Solution {\npublic:\n    int longestPalindrome(vector<string>& words) {\n        int ans=0;\n        bool odd=false;\n        \n        unordered_map<string,int>m;\n        for(string&word:words){\n            m[word]++;\n        }\n        \n        for(int i=0;i<words.size();i++){\n            string rev="";\n            rev+=words[i][1];\n            rev+=words[i][0];\n            \n            if(rev!=words[i]){\n                if(m.count(rev)){\n                    \n                    ans+=(min(1,(min(m[rev],m[words[i]])))*4);\n                    m[rev]>0?m[rev]--:true;\n                    m[words[i]]>0?m[words[i]]--:true;\n                     \n                }\n            }\n            else{\n                \n                ans+=(m[rev]/2)*4;\n                m[rev]%=2;\n                if(m[rev]==1){\n                    odd=true;\n                }\n                 \n            }\n        }\n        \n        odd?ans+=2:true;\n        \n        return ans ;\n    }\n};\n\n```\n# **Please Share and Upvote**
['C', 'C++']