ROMANN - Roman Numerals

no tags 

One day, Eloy the byte was helping his son with his homework... The homework consist in a list of roman numerals that you should convert to Arabic numbers. Eloy doesn't remember very much of the transformations, and he is very confused. He wants help! Now, the task is simple: Build a program that given a list of Roman Numerals, output the equivalent on Arabic numbers.

Eloy knows that each letter means:

  • I = 1
  • V = 5
  • X = 10
  • L = 50
  • C = 100
  • D = 500
  • M = 1000

Input

The first line of the input will be an integer K (1 <= K <= 1000) representing the number of test cases of the program, then, the next K lines will consist in a VALID Roman Numeral. (That means a string with capital letters)

Output

Will consist of K lines denoting the equivalent in Arabic number of the given string with the following system: “Case #i: tk” where i is the test case number starting with 1 and tk is the transformation of the i-th number.

Sample

Input:
3
X
XLVIII
MDCLXVI

Output:
Case #1: 10
Case #2: 48
Case #3: 1666

hide comments
venkatesh_t: 2018-05-17 16:34:28

easyyy

saket diwakar: 2012-05-08 00:26:44

very easy...


Added by:david_8k
Date:2012-01-06
Time limit:0.5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own Problem