Japanese numeral for Ruby kaigi by yattom(kaigi)

#coding:sjis
import sys;n=u'x\x88\xea\x93\xf1\x8eO\x8el\x8c\xdc\x98Z\x8e\xb5\x94\xaa\x8b\xe3';m=u'x\x8f\\x95S\x90\xe7'
for l in sys.stdin:
 s=i=0
 for c in l.decode('utf8')[:-1]:
  try:i=n.index(c)
  except:j=10**m.find(c);s+=j*i if i>0 else j;i=0
 s+=i;print s

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

download

return to the top page