Validate the roman number based on below Rules (DONT use regular exp) and then convent it into number
- To find the value of a set of roman numerals you add up the value of the characters.
- A power of ten can only be repeated three times i.e., XXX = 30, XXXX is not valid.
- Those that are not powers of ten can only appear once, i.e. VV is not valid.
- The numbers must read highest-lowest from the left to the right. (with one exception, see the next rule)
- If a letter of a smaller value appears before a number of a higher value, then the smaller number is to be subtracted from the higher value. ex: IX = 9.
- You can subtract only powers of ten i.e., I, X, C
- Only one character can be used to subtract from a larger character. eg IIX = 8 is not allowed.
- You can't subtract a number from one that is more than 10 times greater. That is, you can only subtract I from V or X, X from L or C, etc. For e.g., IC can not be used for 99. It must be XCIX.