Japanese numeral for Ruby kaigi by naoya_t

{k=1;m=0;for(v=9;v>0;v--)c[substr("\x80\x8c\x89\x9b\x94\xad\x83\xab\x9d",v,1)]=v;d["\x8d\x83"]=1000;d["\x99\xbe"]=100;d["\x8d\x81"]=10;for(i=length()-1;i>0;i-=3){t=substr($1,i,2);if(d[t])z(d[t]);else{v+=k*c[substr(t,2,1)];m=0}}z();print v}function z(x){if(m)v+=k;k=x;m=1}

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

download

return top