main=interact$h.map f.lines;f x=show$g 0 0 x;g _ n[]=n;g 0n(x:xs)|x=='|'=g 0(n+1)xs|0<1=g 1 n xs;g 1n(x:xs)|x=='|'=g 0(n+1)xs|0<1=n;h x=x>>=(++" ")