atcoder#ABC242B. [ABC242B] Minimize Ordering
[ABC242B] Minimize Ordering
Score : points
Problem Statement
You are given a string . Find the lexicographically smallest string obtained by permuting the characters of .
Here, for different two strings and , holds lexicographically when one of the conditions below is satisfied.
- There is an integer such that and for all integers .
- for all integers , and .
Constraints
- is a string of length between and (inclusive) consisting of lowercase English letters.
Input
Input is given from Standard Input in the following format:
Output
Print the lexicographically smallest string obtained by permuting the characters in .
aba
aab
Three strings can be obtained by permuting aba
:
aba
aab
baa
The lexicographically smallest among them is aab
.
zzzz
zzzz