Given a roman numeral s, convert it to an integer.
Roman numerals are denoted by a combination of some symbols.
| Symbol | Value |
|---|---|
| I | 1 |
| V | 5 |
| X | 10 |
| L | 50 |
| C | 100 |
| D | 500 |
| M | 1000 |
s: “X”
Result: 10
s: “VI”
Result: 6
s: “XII”
Result: 12
Read about Roman To Integer conversion here.
The first line contains an integer ‘T’ denoting the number of test cases.
For each test case, the input contains a line with string ‘s’.
For each test case, the output contains one line with an integer ‘val’ denoting the integer value.
3
XV
MMMDCX
XX
15
3610
20
1 <= T <= 100
1 <= s.size <= 15