JavaScript Solution
\nvar longestPalindrome = function(s) {\n    const set = new Set();\n    let count = 0;\n    \n    for (const char of s) {\n        if (set.has(char)) {\n\t\t\t
```\nvar longestPalindrome = function(s) {\n    const set = new Set();\n    let count = 0;\n    \n    for (const char of s) {\n        if (set.has(char)) {\n\t\t\tcount += 2;\n            set.delete(char);\n        } \n\t\telse {\n            set.add(char);\n        }\n    }\n\n    return count + (set.size > 0 ? 1 : 0);\n};\n```
['JavaScript']