Skip to main content

← Strings

Roman numerals

easy

Read a Roman numeral (I, V, X, L, C, D, M; up to 3999). Print its value.

Example 1: input

III

Output

3

Example 2: input

LVIII

Output

58

Plus 3 hidden tests when you check your answer.

Your solution

Read from standard input and print the answer. Run it on the examples as often as you like, then check it against every test.

Stuck?

Open hints one at a time. The write-up explains a full solution.

Discussion

Ask a question or share a tip. Please don’t post full solutions. Posts appear once a moderator approves them.

No posts yet.