CF600C.Make Palindrome

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 ss 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 ss . 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 ss ( 1<=s<=21051<=|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
    
首页