C++ | Map
\nclass Solution {\npublic:\n    int longestPalindrome(vector<string>& w) {\n        \n        map<string, int> m;\n        \n        int res = 0;\n        \n  
```\nclass Solution {\npublic:\n    int longestPalindrome(vector<string>& w) {\n        \n        map<string, int> m;\n        \n        int res = 0;\n        \n        for(auto s : w){\n            \n            string t = s;\n            reverse(t.begin(), t.end());\n            \n            if(m.count(t) != 0){\n                \n                m[t]--;\n                if(m[t] == 0) m.erase(t);   \n                \n                res += 4;\n            }\n            else m[s]++;\n        }\n        \n        for(auto it : m){\n            \n            if(it.second>0) {\n                \n                string str = it.first;\n                \n                if(str[0] == str[1]){\n                    res+=2;\n                    break; \n                }                \n            }\n        }\n        \n        return res;\n    }\n};\n```
['C']