P7773 [COCI 2009/2010 #2] RIMSKI
Background
This problem is from [ $\texttt{COCI 2009-2010}\ 2^\texttt{nd}\ \texttt{round}\ \text{T2 RIMSKI}$ ](https://hsin.hr/coci/archive/2009_2010/contest2_tasks.pdf).
The score setting follows the original problem. The full score is $50$.
Description
Given a Roman numeral $B$, reorder the characters of $B$ so that the value of the resulting numeral is as small as possible.
Input Format
One line containing a Roman numeral $B$.
Output Format
One line containing a Roman numeral, the smallest value you can obtain after reordering.
Explanation/Hint
$1\leq B< 100$.
Note: In this problem, if `I` appears before a larger numeral, it can only appear before `V` or `X`. The input follows the same rule. (This is why the output of sample $4$ is `LI` instead of `IL`.)
Translated by ChatGPT 5