C++✅✅ | 310ms Faster than 98%🔥 |  2 Unordered - Maps | Clean Code |
\n\n# Code\n\n\nclass Solution {\npublic:\n\n   // X  Do Upvote if you Understood the Solution X //\n\n    int longestPalindrome(vector<string>& words) {\n     
\n\n# Code\n```\n\nclass Solution {\npublic:\n\n   // X  Do Upvote if you Understood the Solution X //\n\n    int longestPalindrome(vector<string>& words) {\n        \n        int maxi = 0;\n        int res = 0;\n        bool flag = 0;\n        unordered_map<string,int>mpp1,mpp2;\n\n        for(auto &it : words)\n        {\n           if(it[1]==it[0]) mpp1[it]++;\n              \n           else  mpp2[it]++;\n               \n        }\n        \n        for(auto &it : mpp2)\n        {\n            string r = it.first;\n            reverse(r.begin(),r.end());\n\n            if(mpp2.find(r) != mpp2.end() && mpp2[r] > 0 && it.second > 0)\n            {\n               res += 4 * min(mpp2[r],it.second);\n               mpp2[r] = -1;\n               mpp2[it.first] = -1;\n              \n            }\n        }\n \n        for(auto &it : mpp1)\n        {\n            if(it.second % 2==0)  res += it.second * 2;\n            \n            else\n            {\n                 flag = 1;\n                 res += (it.second-1) * 2;\n            }\n        }\n        \n       if(flag) res += 2;\n       \n       return res;\n    }\n};\n\n\n```
['C++']