def f(x,a="") return[a]if""==x h=x[0,1] t=x[1..-1] case h when'f' f t,h when'(' b,u=f t f u,"(#{a} #{b})" else [a,t] end end loop{puts f(gets)[0]}

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

download

return to the top page