Roman numeral by nn

s=$0{for(n=p=i=0;$0=substr(s,++i,1);n+=p=p<c?c-2*p:c)c=/I/?1:/V/?5:/X/?10:/L/?50:/C/?100:/D/?500:1e3}$0=n

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

download

return to the top page