Problems
572 - Roman Numerals
SUBMIT PROBLEM

Roman Numerals

Time Limit: 1 sec

 

The Problem

Given a string that correctly represents a Roman Numeral, print out the equivalent integer value of that Roman Numeral.

 

Example:

Roman Numeral = VIII

Equivalent Integer Value = 8

 

Roman Numeral = XIV

Equivalent Integer Value = 14

 

The Input

The input start with a positive integer number T (0<T<1001) which denoted the number of test cases. Each test case contain a string which represent the Roman Numeral and the length of the string not more than 20.

[Note: You may assume that the input string always a valid Roman Numeral.]

 

The Output

For each test case, print “Case X: S”, here X is the case number start from 1 to T and S is the equivalent integer value of that Roman Numeral.

 

Sample Input

2

VIII

MCMIV

 

Sample Output

Case 1: 8

Case 2: 1904





Problem Setter: Shahin ShamS