C++ straight forward solution faster than 100%
Logic:\nAny character with even frequency could be included in palindrome.\ni.e.  AAaaBBbb  --> AaBbbBaA\nIn addition, character with odd frequency could be inc
**Logic:**\nAny character with even frequency could be included in palindrome.\ni.e.  AAaaBBbb  --> AaBbbBaA\nIn addition, character with odd frequency could be included by ignoring it\'s one apperance and one char with odd frequency. \ni.e.  AAaaBBbbcccd --> AaBbcccbBaA (OR) AaBbcdcbBaA\n\n**Approach:**\nCalculate freqeuncy of each character.\nFor even frequency, add it to the total.\nFor odd frequency, ignore it\'s one apperance, now this is also char with even frequency, add freq-1 to the total.\nWe can have one char with odd frequncy so add 1 to the total. (If char with odd frequency are there.)\n\n**Code:**\n```\nclass Solution {\npublic:\n    int longestPalindrome(string s) {\n        int freq[52]={0},total=0,flag=0;\n        for(int i=0;i<s.length();i++){\n            if(s[i]>=\'a\')\n                freq[s[i]-\'a\'+26]++;\n            else\n                freq[s[i]-\'A\']++;\n        }\n        for(int i=0;i<52;i++){\n            if(freq[i]%2){\n                total+=freq[i]-1;\n                flag=1;\n            }\n            else\n                total+=freq[i];\n        }\n        if(flag)\n            total+=1;\n        return total;\n    }\n}; \n```\n\n
[]