#P7773. [COCI 2009/2010 #2] RIMSKI
[COCI 2009/2010 #2] RIMSKI
Background
This problem is from $\texttt{COCI 2009-2010}\ 2^\texttt{nd}\ \texttt{round}\ \text{T2 RIMSKI}$ .
The score setting follows the original problem. The full score is .
Problem Description
Given a Roman numeral , reorder the characters of so that the value of the resulting numeral is as small as possible.
Input Format
One line containing a Roman numeral .
Output Format
One line containing a Roman numeral, the smallest value you can obtain after reordering.
VIII
VIII
VI
IV
III
III
LI
LI
Hint
.
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 is LI instead of IL.)
Translated by ChatGPT 5