Easy20 pts
Roman to Integer
Convert a Roman numeral string to an integer. I=1, V=5, X=10, L=50, C=100, D=500, M=1000 If smaller value before larger, subtract (IV=4). Otherwise add. Example: 'MCMXCIV' → 1994 (M=1000 + CM=900 + XC=90 + IV=4)
Input
A single line containing a Roman numeral string.
Output
The integer value.
Sample
MCMXCIV
Expected
1994
Loading editor…
Output
No output yet. Run your code to see results.