#K93652. Roman Numeral Converter

    ID: 38467 Type: Default 1000ms 256MiB

Roman Numeral Converter

Roman Numeral Converter

The problem requires you to convert a given Roman numeral string to its corresponding integer value. Roman numerals consist of the symbols ( I=1 ), ( V=5 ), ( X=10 ), ( L=50 ), ( C=100 ), ( D=500 ), and ( M=1000 ). When a smaller numeral appears before a larger numeral, it is subtracted from the larger numeral; for example, ( IV=4 ) and ( IX=9 ). Your task is to implement a converter that accurately computes the integer value represented by a valid Roman numeral. The input numeral is guaranteed to be well-formed and represents an integer between 1 and 3999, inclusive.

inputFormat

The input consists of a single line read from standard input (stdin), containing a valid Roman numeral string.

outputFormat

Output the integer value of the given Roman numeral to standard output (stdout).## sample

MCMXCIV
1994

</p>