Kotlin - pure functional
\nclass Solution {\n    fun longestPalindrome(s: String): Int {\n        return minOf(\n            s.length,\n            1 + s\n                .groupingBy { 
```\nclass Solution {\n    fun longestPalindrome(s: String): Int {\n        return minOf(\n            s.length,\n            1 + s\n                .groupingBy { it }\n                .eachCount()\n                .map { (k, v) -> v / 2 * 2 }\n                .sum()\n        )\n    }\n}\n```
['Kotlin']