Converts between Roman numerals and integers in both directions. See Roman numerals — Wikipedia.
Standard Roman numeral values: I=1, V=5, X=10, L=50, C=100, D=500, M=1000
Subtractive notation: when a smaller value precedes a larger one, it is subtracted — e.g. IV=4, IX=9, XL=40, XC=90, CD=400, CM=900.
Roman → Integer: Scan right to left. If the current value is less than the previous, subtract it; otherwise add it.
Integer → Roman: Greedily subtract the largest symbol value that fits, including subtractive pairs.
python roman_numerals.py # built-in demo
python roman_numerals.py XIV # Roman to integer
python roman_numerals.py 1994 # Integer to Roman