✅✅ c++ || Intuituve || Map ||
class Solution {\npublic:\n    int longestPalindrome(vector& words) \n    {\n        map mp;\n        for(int i=0;i<words.size();i++)\n            mp[words[i]]+
class Solution {\npublic:\n    int longestPalindrome(vector<string>& words) \n    {\n        map<string,int> mp;\n        for(int i=0;i<words.size();i++)\n            mp[words[i]]++;\n\n        int ans=0,m=0;\n        bool flag=false;\n        for(auto x: mp)\n        {\n            string s=x.first;\n            string t=s;\n            reverse(s.begin(),s.end());\n            if(s==t)\n            {\n                ans+=x.second/2;\n                if(x.second%2) \n                    flag=true;\n            }\n            else\n            {\n                if(mp.count(s))\n                    ans+=min(x.second,mp[s]),mp.erase(s);\n            }\n        }\n        ans=ans*4;\n        if(flag) \n            ans+=2;\n        return ans;\n    }\n};
['C']