Roman numeral by Hawkseye

c,o=0,s=0,n,p=0;main(){while(c=getchar()+1)if(n=c-74?c-87?c-89?c-77?c-68?c-69?c-78?0:1000:500:100:50:10:5:1){if(p-n){o+=p>n?s:-s;s=0;}s+=p=n;}else{printf("%d\n",o+s);o=s=p=0;}}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page