using dictnory in TC=N
\nclass Solution:\n    def longestPalindrome(self, words: List[str]) -> int:\n        dc=defaultdict(lambda:0)\n        for a in words:\n            dc[a]+=1\n 
```\nclass Solution:\n    def longestPalindrome(self, words: List[str]) -> int:\n        dc=defaultdict(lambda:0)\n        for a in words:\n            dc[a]+=1\n        count=0\n        palindromswords=0\n        inmiddle=0\n        wds=set(words)\n        for a in wds:\n            if(a==a[::-1]):\n                if(dc[a]%2==1):\n                    inmiddle=1\n                palindromswords+=(dc[a]//2)*2\n            elif(dc[a[::-1]]>0):\n                count+=(2*(min(dc[a],dc[a[::-1]])))\n                dc[a]=0\n        return (palindromswords+count+inmiddle)*2\n        ``\n```
['Python', 'Python3']