← 返回 amazon 的题目列表Lexicographically Smallest Symmetric Name Rearrangement
类型:online_judge
amazon
Given an initial symmetrical name that contains only lowercase English characters, compute the encoded name.
The rearranged name is a reshuffled version of the original symmetrical name.
The rearranged name should be symmetrical as well.
This rearranged name should be lexicographically smallest among all its symmetric permutations.
Note: The output encoded name could match the original if it's already lexically smallest.
Example
The original string is "babah".
This can be reversed to give "ahbba", which is a symmetric rearrangement of the original name and is the smallest possible symmetric rearrangement.
It satisfies all the requirements and returns the encoded string "ahbba".
Example
Input
babah