#K71072. Form a Palindrome

    ID: 33450 Type: Default 1000ms 256MiB

Form a Palindrome

Form a Palindrome

You are given a string t consisting of lowercase letters. Your task is to determine if it is possible to rearrange all of its characters to form a palindrome.

If a palindrome can be formed, output the lexicographically smallest palindrome that can be obtained by rearranging the characters. Otherwise, output -1.

A palindrome is a string that reads the same forwards and backwards. Mathematically, for a string S of length n, it must satisfy:

\[ S[i] = S[n-i-1] \quad \text{for all } 0 \leq i < n \]

Note: A valid palindrome formed by rearranging the characters of t will use each character exactly as many times as it appears in t.

inputFormat

The input is read from stdin and consists of a single line containing the string t (1 ≤ |t| ≤ 105), composed only of lowercase English letters.

outputFormat

Output to stdout a single line. If it is possible to rearrange the characters of t to form a palindrome, print the lexicographically smallest palindrome possible. Otherwise, print -1.

## sample
aabb
abba