#K60862. Longest Palindromic Rearrangement

    ID: 31181 Type: Default 1000ms 256MiB

Longest Palindromic Rearrangement

Longest Palindromic Rearrangement

Given a string (s), rearrange its characters to form one of the longest possible palindromes. A palindrome is a string that reads the same forwards and backwards, i.e. (P = P^R), where (P^R) is the reverse of (P). If the string is empty, output an empty string. In cases where there are multiple valid answers, any one is accepted.

inputFormat

The input consists of a single line containing the string (s).

outputFormat

Output a single line containing one of the longest palindromic rearrangements of (s).## sample

abba
abba