t=['']l=[0]gets.chars{|c|c<?]?t<<''&&(l<<0)[-2]+=1:c<?^?(x=l.pop;t.pop==''&&(puts t*''if x<1;t[-1]='')):t[-1]<<c}
cat[s[up[][]][]ch[e[r[]s[]]]a[maran[]comb[]pult[[]ing[]]]]
catsup cats cat catcher catches catamaran catacomb catapult catapulting
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!