postfix to infix by Mark Byers

a='_*+,/+,*-,/-'
b=c=['%s','(%s)']
d=b.pop
while 1:
 for e in raw_input():
\x09_=e
\x09if _<a:f,g=d();h,i=d();_=c[_+i in a]%h+_+c[_+g in'//*--+'+a]%f
\x09b+=[(_,e)]
 print _

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

download

return to the top page