C# LINQ-based 2-liner
\n    public int LongestPalindrome(string s) {\n        var even = s.GroupBy(c => c).Select(g => g.Count() & ~1).Sum();\n        return even < s.Length ? even +
```\n    public int LongestPalindrome(string s) {\n        var even = s.GroupBy(c => c).Select(g => g.Count() & ~1).Sum();\n        return even < s.Length ? even + 1 : even;\n    }\n```
[]