4. Write a function called fun9 that takes a string input representing an integer between I and 399 inclusive using Roman numerals and returns the Arabic equivalent as a uint16. If the input is illegal, or its value is larger than 399, the function returns 0 instead. The function must use only the shortest possible Roman representation in each case. This rule eliminates four or more consecutive identical symbols, such as 1111, which equals IV, and XXXX, which equals XL, and it eliminates the use of subtractive notation followed by additive notation with the same symbol, such as IXI, which equals X. The rules useful for Roman-Arabic conversion are as follows: a. Smaller numerals follow larger numerals (see rule c below). Summing the values of the numerals gives the value of the number b. The numerals I, X, C and M (all powers of 10) may be repeated up to three times in a row. No other numerals may be repeated, i.e., VV or LL is invalid. c. Sometimes, a smaller numeral may precede a larger one (eg. IV). These cases form compound numerals which arc evaluated by subtracting the value of the smaller numeral from the larger one. To form a compound numerals all the following conditions must be met: i. The smaller numeral must be a power of ten ( I, 10, 100, 10(X)) ii. The smaller numeral must be either one-fifth or one-tenth the value of the larger one iii. The smaller numeral must either be the first numeral in the number, or follow a numeral of at least ten times its value

Attachments: