C++ beats 100%
C++ beats 100%\n\n\n\n# Code\n\nclass Solution {\npublic:\n    int longestPalindrome(string s) {\n        vector<int>lower(26,0);\n        vector<int>upper(26,0
C++ beats 100%\n![image.png](https://assets.leetcode.com/users/images/76d99cb4-9816-4d92-bcf6-5a7a7a5a1f5e_1717462913.0046773.png)\n\n\n# Code\n```\nclass Solution {\npublic:\n    int longestPalindrome(string s) {\n        vector<int>lower(26,0);\n        vector<int>upper(26,0);\n        for(int i=0;i<s.size();i++){\n            if(s[i]>=\'a\'){\n                lower[s[i]-\'a\']++;\n            }\n            else{\n                upper[s[i]-\'A\']++;\n            }\n\n        }\n        int c=0;\n        int f=0;\n        for(int i=0;i<26;i++){\n            if(lower[i]%2==0){\n                c += lower[i];\n            }\n            else{\n                c += lower[i]-1;\n                f=1;\n            }\n            if(upper[i]%2==0){\n                c += upper[i];\n            }\n            else{\n                c += upper[i]-1;\n                f=1;\n            }\n\n        }\n        return c+f;\n        \n    }\n};\n```
['C++']