c++ || hashmap || easy-to-understand solution
\nclass Solution {\npublic:\n    int longestPalindrome(vector<string>& words) {\n        \n\t\t//initialize  a map to store the occurances of all words\n       
```\nclass Solution {\npublic:\n    int longestPalindrome(vector<string>& words) {\n        \n\t\t//initialize  a map to store the occurances of all words\n        unordered_map<string, int> mp;\n        \n\t\t//storing occurances of all words\n        for(auto i:words) mp[i]++;\n            \n\t\t//this variable will be used later\n        bool flag = false;\n        int ans = 0;\n                \n\t\t//iterating our map\n        for(auto i:mp){\n            \n            string temp = i.first;\n            reverse(temp.begin(), temp.end());\n            \n\t\t\t//checking if it is palindrome word itself and the count of it is odd\n\t\t\t//this word can be inserted in the middle of our palindrome as it is palindrome itself\n\t\t\t//but this can be done only once \n\t\t\t\n            if(temp == i.first and i.second%2!=0 and flag == false){\n\t\t\t\t//we mark our flag to true because we want to insert this element only once in the middle\n                flag = true;\n                ans+=2;\n                mp[temp]--;\n            }\n            \n\t\t\t//checking if the word as well its reverse exist in the map\n            if(mp.find(i.first)!=mp.end() and mp.find(temp)!=mp.end()){\n        \n\t\t\t\t//for the case when the word is not palindrome we will increase our ans by minimum of the count of word in the map and reverse of word in the map multiplied by 4\n                if(i.first!=temp){\n                    ans += min(mp[i.first], mp[temp])*2*2;\n                    mp[i.first]=mp[temp]=0;\n                }\n\t\t\t\t//for the case when it is palindrome we just divide the count of the word by 2 and then multiply by 4 and add to the ans\n                else{\n                    ans+=mp[temp]/2 *2*2;\n                    mp[i.first]=mp[temp]=0;\n                    \n                }\n            }   \n        }\n        return ans;\n\t\t\n    }\n};\n```
['C', 'C++']