using System.Collections.Generic;
private static Dictionary<char, int> romanNumeralDict = new Dictionary<char, int>()
public static int RomanToInteger(string stringInput)
char previousRomanChar = stringInput[0];
foreach (char currentChar in stringInput)
convertedResult += romanNumeralDict[currentChar];
if (romanNumeralDict[previousRomanChar] < romanNumeralDict[currentChar])
convertedResult -= romanNumeralDict[previousRomanChar] * 2;
previousRomanChar = currentChar;
public static void Main(string[] args)
Console.Write("Enter the roman numeral: ");
string inputString = Console.ReadLine();
Console.WriteLine("In Arabic: " + RomanToInteger(inputString));