A simple way to do this is by reading the entire roman number string and then processing the strings from the back.
Eg: XIV you start with V, = 5 move back 1, now it's I, I is less than
V so now subtract off 1, which is 4. Then you move back to X, and now
X is greater than I, so add 10 to the earlier value (which was 4),
which then becomes 4+10 = 14.
Step 1: Start
Step 2: read the roman numerical as string
Step 3: find length of the roman numerical
Step 4: for each character in the string
1. if(char = I) then decimal = 1
2. if(char = V) then decimal = 5
3. if(char = X) then decimal = 10
4. if(char = L) then decimal = 50
5. if(char = C) then decimal = 100
6. if(char = D) then decimal = 500
7. if(char = M) then decimal = 1000
8. otherwise invalid character
Step 5: repeat step 4 until the length of the string
Step 6: k = char[length - 1]
Step 7: for each character of decimal string
if(decimal[i] > decimal[i - 1]) then k = k - decimal[i - 1]
else if(decimal[i] = decimal[i - 1 or decimal[i] < decimal[i - 1) then k = k + decimall[i - 1]
Step 8: repeat step 7 until the length of decimal string
Step 9: print decimal value
Step 10: Stop