Counting adventure by hide24

gets.to_i.times{|i|$_=c=[a=%w(one two three four five six seven eight nine),%w(ten eleven twelve),(b=%w(thir four fif six seven eigh nine)).map{|x|x+'teen'},['twen',*b].map{|x|x[/u|$/]='';[x+='ty']+a.map{|y|[x,y]*'-'}},'one hundred'].flatten[i]
sub(/[ety]?$/){$&<'y'?:th:'ieth'}if sub(/one$|two|three/){%w(first second third)[i%10]}==c&&sub(/ve$/,'f')
puts"The %s positive integer is %s."%[$_,c]}

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

download

return top