Python O(3n), O(n)
we loop over the list 1 time forwards, we invert every string for comparision and we loop over the dictionary at the end to see if there are any single pairs we
we loop over the list 1 time forwards, we invert every string for comparision and we loop over the dictionary at the end to see if there are any single pairs we can add, eg "aa".\n\nSpace complexity is O(n) as we potentially store a copy of every word in our frequency count dictionary.\n```\nclass Solution:\n    def longestPalindrome(self, words: List[str]) -> int:\n        # SOL from discussion using dictionary\n        d = {}\n        res = 0\n        for w in words:\n            temp = w[::-1]\n            if temp in d and d[temp] > 0:\n                d[temp] -= 1\n                res += 4\n            else:\n                d[w] = d.get(w, 0) + 1\n        for i in d:\n            if i == i[::-1] and d[i] > 0:\n                return res+2\n        return res\n```
['Python']