Simple Intutive Solution with explanation | clean code [c++/go]
Intuition\n- We can count pairs to get our result. Count all pairs pairs and we can form string of length pairs*2 + 1\n- If summing up pairs does not equals to 
# Intuition\n- We can count pairs to get our result. Count all pairs `pairs` and we can form string of length `pairs*2 + 1`\n- If summing up pairs does not equals to lenght of string it means there is atleast one character without pair we can use that in pallindrome as well\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n- create a map to store count of each character. \n- Iterate through string and check if count of current is even if yes means we got our pair so we can increment pairs count\n- At the end check if `pairs*2` is equal to n if yes means there is no character with odd length so return n else we can also one odd character and return `pairs*2+1`\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(n) for single pass over input string\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(52) for stroing all char count \n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```C++ []\nclass Solution {\npublic:\n    int longestPalindrome(string s) {\n        int n=s.size(),pairs=0;\n        map<char, int> c;\n        for(int i=0;i<n;i++) {\n            c[s[i]]++;\n            if(c[s[i]]%2==0)pairs++;\n        }\n        return pairs*2==n?n:pairs*2+1;\n    }\n};\n```\n```Go []\nfunc longestPalindrome(s string) int {\n\tn := len(s)\n\tpairs := 0\n\tcount := map[rune]int{}\n\tfor _, ch := range s {\n\t\tcount[ch]++\n\t\tif count[ch]%2 == 0 {\n\t\t\tpairs++\n\t\t}\n\t}\n\tif pairs*2 == n {\n\t\treturn n\n\t}\n\treturn pairs*2 + 1\n}\n```
['C++', 'Go']