Python 3   ||   4 lines, w/ example  || T/S: 99% / 12%
\nclass Solution:\n    def longestPalindrome(self, words: list[str]) -> int:\n                                                            # Ex words = ["cc","ll
```\nclass Solution:\n    def longestPalindrome(self, words: list[str]) -> int:\n                                                            # Ex words = ["cc","ll","xx","cc","ll","lc","cl","gg", \'af\']\n\n        d = Counter(words)                                  # d = {\'cc\': 2, \'ll\': 2, \'xx\': 1, \'lc\': 1, \'cl\': 1, \'gg\': 1, \'af\': 1}\n        same = {n for n in d if n[0] == n[1]}               # same = {\'cc\', \'ll\', \'xx\', \'gg\'}\n        diff = set(d) - same                                # diff = {\'lc\', \'af\', \'cl\'}\n\n        return (2*sum({d[n]%2 for n in same}) +             # 2 * sum({0, 0, 1, 1}) = 2 * sum ({0, 1}) = 2+1    = 2\n               sum(d[n]//2 for n in same)*4 +               # sum(1, 1, 0, 0) * 4                               = 8   \n               2*sum(min(d[n[::-1]], d[n]) for n in diff))  # 2 * (min(1,1) + min(0,1) + min(1,1)) = 2(1+0+1)   = 4\n                                                            #                                                    \u2013\u2013\u2013\n                                                            # return                                              14 <-- answer\n\n```\n\n[https://leetcode.com/problems/longest-palindrome-by-concatenating-two-letter-words/submissions/1285389782/](https://leetcode.com/problems/longest-palindrome-by-concatenating-two-letter-words/submissions/1285389782/)\n\nI could be wrong, but I think that time complexity is *O*(*N*) and space complexity is *O*(*N*), in which *N* ~ `len(words)`.
['Python3']