I,V,X,L,C,D,M=1,5,10,50,100,500,1000;e=eval\x0d while 1:\x0d s=raw_input();t=s[-1]\x0d for c in s[-2::-1]:\x0d t+='+-'[e(c)<e(t[-1])]+c\x0d print(e(t))
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page