def m(n,k) n>0?n*m(n-k,k):1 end loop{s=gets p m(s.to_i,s.count("!"))}

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

download

return top