Spoken Numbers by leonid

puts f(eval gets).split*" "until def f n
l=%w"twen thir fo%sr fif six seven eigh nine"
n>99?[f(n/d=10**"\x09\x06\x03\x02"[k=-"#{n}".size/3]),%w{billion million thousand hundred}[k],f(n%d)]*$/:n<20?%W{\r one two three four five six seven eight nine ten eleven twelve}[n]||l[n-12]%:u+"teen":l[n/10-2]%p+"ty "+f(n%10)end

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

download

return top