cswork / OA打开练习工作台

AmazonOA #115

Compute Encoded Product Name

估计简单可在线判题

考点(AI 标注)哈希计数字符串

The input is guaranteed to be a lowercase palindrome. Rearrange all of its characters and output the lexicographically smallest string that is still a palindrome; leaving the original string unchanged is allowed.

输入格式

One line with a palindrome of length 1..100000, containing only lowercase letters.

输出格式

Output the lexicographically smallest palindrome.

样例 1

输入:

babab

输出:

abbba

样例 2

输入:

cabbac

输出:

abccba

样例 3

输入:

z

输出:

z

样例说明

Example 1: a appears twice and b three times, so the left half is ab, the center is b and the right half is ba; output abbba. Example 2: the left half is abc, which mirrors to abccba. Example 3: a single z stays unchanged.