LearnPy Hub
← Dictionaries problems
Hard

Roman Numerals

Read a Roman numeral (I, V, X, L, C, D, M) and print its value. A smaller value before a larger one is subtracted (IV = 4).

Input

One Roman numeral.

Output

An integer.

Sample 1

Input
III
Output
3

Sample 2

Input
IV
Output
4
solution.py
Output appears here
Roman Numerals · Python practice problem · LearnPy Hub