/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static int longestPalindrome
(String s
) { int[] count = new int[128];
for (char c: s.toCharArray())
count[c]++;
int ans = 0;
for (int v: count) {
ans += v / 2 * 2;
if (ans % 2 == 0 && v % 2 == 1)
ans++;
}
return ans;
}
{
// your code goes here
System.
out.
println("The length of longest palindrome is:- " + longestPalindrome
("abccccdd")); }
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKICAgICAgICBwdWJsaWMgc3RhdGljIGludCBsb25nZXN0UGFsaW5kcm9tZShTdHJpbmcgcykgewogICAgICAgIGludFtdIGNvdW50ID0gbmV3IGludFsxMjhdOwogICAgICAgIGZvciAoY2hhciBjOiBzLnRvQ2hhckFycmF5KCkpCiAgICAgICAgICAgIGNvdW50W2NdKys7CgogICAgICAgIGludCBhbnMgPSAwOwogICAgICAgIGZvciAoaW50IHY6IGNvdW50KSB7CiAgICAgICAgICAgIGFucyArPSB2IC8gMiAqIDI7CiAgICAgICAgICAgIGlmIChhbnMgJSAyID09IDAgJiYgdiAlIDIgPT0gMSkKICAgICAgICAgICAgICAgIGFucysrOwogICAgICAgIH0KICAgICAgICByZXR1cm4gYW5zOwogICAgfQoJCglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQkvLyB5b3VyIGNvZGUgZ29lcyBoZXJlCgkJU3lzdGVtLm91dC5wcmludGxuKCJUaGUgbGVuZ3RoIG9mIGxvbmdlc3QgcGFsaW5kcm9tZSBpczotICIgKyBsb25nZXN0UGFsaW5kcm9tZSgiYWJjY2NjZGQiKSk7Cgl9Cn0=