main=interact$h.(iterate f[]!!).read f[]=["0"] f(x:y)=do z<-f y;[z,x#z] x#"0"=h[x] x#y=h[x,init$tail y] h x='{':drop 2(x>>=(", "++))++"}"