Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Speedy category for Reverse Roman Numerals by ciel
def reverse_roman(roman):
m={'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000}
r=0
for i in range(len(roman)):
r+=m[roman[i]]*(1 if i==len(roman)-1 or m[roman[i]]>=m[roman[i+1]] else -1)
return r
July 5, 2017