C++ solutions
\nclass Solution {\npublic:\n    int longestPalindrome(vector<string>& words) {\n        /* There are a number of matching digraphs and its reversal */\n       
```\nclass Solution {\npublic:\n    int longestPalindrome(vector<string>& words) {\n        /* There are a number of matching digraphs and its reversal */\n        /* There are an even number of matching squares */\n        /* Among the squares, select one square that has odd number */\n        int count = 0;\n        map<string, int> freq; // Noticed an unordered map breaks the program for larger inputs\n        int var;\n        int odd = 0;\n        for (string word : words) {\n            freq[word]++;\n        }\n        for (const auto& [key, value] : freq ) {\n            if (key[0] == key[1]) {\n                if (!odd && freq[key] % 2 == 1) {\n                    odd++;\n                }\n                count += 2*(freq[key] / 2);\n            }\n            else {\n                var = min(freq[key], freq[{key[1],key[0]}]);\n                count += 2*var;\n                freq[key] = 0;\n                freq[{key[1],key[0]}] = 0;\n            }\n        }\n        return 2*(count + odd);\n    }\n};\n```
['C', 'C++']