Question: In data sometimes the same product will be named with a roman numeral while other times it will be a digit.

**Example** `Samsung Galaxy SII` verses `Samsung Galaxy S2`

How can the `II` be converted to the value `2`?

Answer: 
```
public class Solution {
public int RomanToInt(string s) {
    var dict = new Dictionary<char,int>{
        {'I',1},
        {'V',5},
        {'X',10},
        {'L',50},
        {'C',100},
        {'M',1000},
        {'D',500}, 
    };

    var result = 0; //What am I gonna return it from method  ?
    for(int i=0; i<s.Length; i++)
    {
        if(i+1<s.Length && dict[s[i]] < dict[s[i+1]])
        {
            result -=dict[s[i]];

        }
        else
        {
             result +=dict[s[i]];

        }
    }
    return result;

}
}

```
```
public int RomanToInt(string s)
{
    char[] romans = { 'I', 'V', 'X', 'L', 'C', 'D', 'M' };
    int[] nums = { 1, 5, 10, 50, 100, 500, 1000 };

    int result = 0;

    foreach (char c in s)
    {
        for (int i = 0; i < romans.Length; i++)
        {
            if (romans[i] == c)
            {
                result += nums[i];
            }
        }
    }

    if (s.Contains("IV") || s.Contains("IX"))
        result -= 2;

    if (s.Contains("XL") || s.Contains("XC"))
        result -= 20;

    if (s.Contains("CD") || s.Contains("CM"))
        result -= 200;

    return result;
}

```