Roman numerals are V for 5, X for 10, L for 50, C for 100, D for 500, and M for 1,000.
Recall that some numbers are formed by using a kind of subtraction of one Roman “digit”; for example, IV is 4 produced as V minus I, XL is 40, CM is 900, and so on.
A few sample years: MCM is 1900, MCML is 1950, MCMLX is 1960, MCMXL is 1940, MCMLXXXIX is 1989.
(Hints: Use division and mod.)
Assume the year is between 1000 and 3000.