| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 6 | 6 | 6 | 100.000% |
We are going to organise the letters of the word using a novel algorithm based on the natural instincts of the hoarse chestnut tree: a grand tournament between its constituent letters.
We will pick several pairs of letters and have them face off. The result of a match between these letters determines their relative order. For example, if $a < b$, then all occurrences of $a$ in a well-organised word should come before all occurrences of $b$ in that word. If there is no case for $a < b$ or $b < a$, then the individual letters $a$ and $b$ may intersperse among each other in any order.
Given a word, and several such matches, determine a fair rearrangement of the word to meet all of the constraints given. It is possible that multiple such rearrangements exists, or that none exist at all.
< or > character and spaces.Output a sorted version of the word, or IMPOSSIBLE if the word cannot be sorted according to all of the rules at once.
In case there are multiple answers, you may output any one of them.
3 m > i n < i i > o minion
noniim
1 b < n banana
banana
6 b < a a > b n < b a > b n < b a > b bananaman
nnnbaaama
2 a < b b < a unsolvable
IMPOSSIBLE