#C13844. Roman Numeral to Integer Conversion
Roman Numeral to Integer Conversion
Roman Numeral to Integer Conversion
You are given a Roman numeral in the form of a string. Your task is to convert this Roman numeral into its integer representation. Roman numerals are usually written largest to smallest from left to right. However, there are a few exceptions where a smaller numeral appears before a larger one, indicating that the smaller numeral should be subtracted. For example, (IV = 4) and (IX = 9). The valid Roman numeral symbols are: I = 1, V = 5, X = 10, L = 50, C = 100, D = 500, and M = 1000. Your program should read the numeral from standard input and print the corresponding integer on standard output.
inputFormat
Input consists of a single line containing a valid Roman numeral string. The numeral represents a number in the range of 1 to 3999.
outputFormat
Output the integer representation of the Roman numeral as a single number.## sample
III
3