Roman numbers (2) P29253


Statement
 

pdf   zip

html

Write a program that reads Roman numbers and prints their values.

Input

Input consists of several Roman numbers, as explained in the exercise P18298: “Roman numbers (1)”. Every number ends in a period.

Output

For each Roman number, print its value.

Public test cases
  • Input

    I.
    IV.
    X.
    XL.
    XLI.
    XVI.
    MMDCCVIII.
    CMXCIX.
    MMMV.
    

    Output

    I = 1
    IV = 4
    X = 10
    XL = 40
    XLI = 41
    XVI = 16
    MMDCCVIII = 2708
    CMXCIX = 999
    MMMV = 3005
    
  • Information
    Author
    Jordi Petit
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Java Python
    User solutions
    C C++ Java Python