C++ Easy and Fast Solution
\nclass Solution {\npublic:\n    int longestPalindrome(vector<string>& A) {\n        unordered_map<string, int> m;\n        for (auto &s : A) m[s]++;\n        i
```\nclass Solution {\npublic:\n    int longestPalindrome(vector<string>& A) {\n        unordered_map<string, int> m;\n        for (auto &s : A) m[s]++;\n        int ans = 0, even = 0, odd = 0;\n        for (auto &[s, cnt] : m) {\n            if (s[0] == s[1]) {\n                if (cnt % 2) odd = 1;\n                even += cnt - cnt % 2;\n            } else {\n                string r(rbegin(s), rend(s));\n                if (m.count(r)) {\n                    ans += min(cnt, m[r]) * 2;\n                    cnt = 0;\n                }\n            }\n        }\n        return (ans + even + odd) * 2;\n    }\n};\n```
['C++']