Roman numeral by tanakh

main@m=getLine>>=print.h>>m
h l=f[n|c<-l,(d,n)<-zip"IVXLCDM"a,c==d];a=1:5:map(*10)a
f(x:y:z)|x<y=y-x+f z;f(x:y)=x+f y;f[]=0

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

download

return to the top page