303080: CF600C. Make Palindrome

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Make Palindrome

题意翻译

给出一个由小写字母组成的字符串 $s$。首先你可以改变 $s$ 中任意多个字母。然后你可以改变 $s$ 中各个字母的排列顺序。问如果要将 $s$ 变成回文串至少要改变多少个字母?(改变排列顺序不算改变字母)

题目描述

A string is called palindrome if it reads the same from left to right and from right to left. For example "kazak", "oo", "r" and "mikhailrubinchikkihcniburliahkim" are palindroms, but strings "abb" and "ij" are not. You are given string $ s $ consisting of lowercase Latin letters. At once you can choose any position in the string and change letter in that position to any other lowercase letter. So after each changing the length of the string doesn't change. At first you can change some letters in $ s $ . Then you can permute the order of letters as you want. Permutation doesn't count as changes. You should obtain palindrome with the minimal number of changes. If there are several ways to do that you should get the lexicographically (alphabetically) smallest palindrome. So firstly you should minimize the number of changes and then minimize the palindrome lexicographically.

输入输出格式

输入格式


The only line contains string $ s $ ( $ 1<=|s|<=2·10^{5} $ ) consisting of only lowercase Latin letters.

输出格式


Print the lexicographically smallest palindrome that can be obtained with the minimal number of changes.

输入输出样例

输入样例 #1

aabc

输出样例 #1

abba

输入样例 #2

aabcd

输出样例 #2

abcba

Input

题意翻译

给出一个由小写字母组成的字符串 $s$。首先你可以改变 $s$ 中任意多个字母。然后你可以改变 $s$ 中各个字母的排列顺序。问如果要将 $s$ 变成回文串至少要改变多少个字母?(改变排列顺序不算改变字母)

加入题单

上一题 下一题 算法标签: