LogiQuest

106. Roman to Integer

EasyHash Map

Convert a Roman numeral (I, V, X, L, C, D, M, with subtractive forms like IV and CM) to an integer.

Input format

A single Roman numeral.

Output format

Its value.

Example 1

Input

III

Output

3

Example 2

Input

LVIII

Output

58

Constraints

1 ≤ value ≤ 3999

Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.

Loading the MyLoginn IDE…