Simple and Easy, Python, O(n) time and space
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(n)\n Add your space complexity here, e.g. O(n) \n\n# Co
# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def longestPalindrome(self, words: List[str]) -> int:\n        map = {}\n        occur = False\n        count = 0\n        for word in words:\n            map[word] = (map[word]+1) if word in map else 1\n        for key in map:\n            rev = key[1] + key[0]\n            if key!=rev and rev in map:\n                count+= min(map[key],map[rev])*2\n                map[key] = 0\n            elif key == rev:\n                if map[key]%2!=0:\n                    occur = True\n                    map[key] -= 1\n                count += map[key] + (-1 if map[key]%2!=0 else 0)\n                map[key] = 0\n        return count*2 + (2 if occur else 0)\n\n\n```
['Python3']