C# Solution | Time: O(n), Memory: O(n) | Easy to understand, Dictionary
C#\npublic class Solution {\n    public int LongestPalindrome(string[] words) {\n        Dictionary<string, int> d = new ();\n        \n        int ans = 0;\n  
```C#\npublic class Solution {\n    public int LongestPalindrome(string[] words) {\n        Dictionary<string, int> d = new ();\n        \n        int ans = 0;\n        for (int i = 0; i < words.Length; i++) {\n            string reversed = $"{words[i][1]}{words[i][0]}";\n            if (d.TryGetValue(reversed, out int t) && t > 0) {\n                ans += 4;\n                d[reversed] = t - 1;\n            } else {\n                if (!d.ContainsKey(words[i])) d[words[i]] = 0;\n                d[words[i]]++;\n            }\n        }\n        \n        if (d.Any(x => x.Value > 0 && x.Key[0] == x.Key[1])) ans += 2;\n        \n        return ans;\n    }\n}\n```
[]