Although today's use of Roman numerals is typically limited to movie titles or the pages preceding the main part of a book (and thus are typically small), let's build a Roman-to-decimal converter anyway. Just for the LOLs.

The output file OUT4.txt will contain 5 lines, the decimal values of the input numbers.

For your reference, the symbols are as follows:

I 1
V 5
X 10
L 50
C 100
D 500
M 1000

Numbers in between the symbols are constructed by adding the symbols together (e.g. II for 2) - or by subtracting, which is done by placing a smaller symbol in front of a larger one (e.g. IV for 4).

Note: Be cautious that the numbers are slightly more complicated than simply adding the values of symbols in order. While XI (11), XII (12), XIII (13) are simple enough, XIV (14) breaks the pattern (that is, it is not 10 + 1 + 5, but 10 + (5 - 1)).