C++ || HASH MAP APPROACH
we will store the number of occurrence of each string.\nthe number of pair that are vaild to form a palindrome will be \nmin(x,y)   \nwhere x is the no. of time
we will store the number of occurrence of each string.\nthe number of pair that are vaild to form a palindrome will be \nmin(x,y)   \nwhere x is the no. of times a string s appears in vector words.\n   and y is the no. of times the reverse of string s appears in vector words.\n   \n  if there is a string in the vector which appears odd number of times and it is a palindrome itself then we will add that to the final answer.\n\n```\nclass Solution {\npublic:\n    int longestPalindrome(vector<string>& words) {\n        unordered_map<string,int> mp;\n        int count=0;\n        for(string word:words)\n        {\n           mp[word]++;\n        }\n        unordered_set<string> s;\n        bool flag=false;\n        for(string word:words)\n        {\n            if(s.count(word)==0)\n            {\n                string t="";\n                t+=word[1];\n                t+=word[0];\n                if(t==word)\n                    count+=mp[t]/2;\n                else count+=min(mp[t],mp[word]);\n                s.insert(t);\n                s.insert(word);\n                if(mp[t]%2==1 && t[0]==t[1])\n                    flag=true;\n            }\n        }\n        count=count*4;\n        if(flag) count+=2;\n        return count;\n    }\n};\n```
['C']