main=interact$f;f s=s++'\n':foldl1(#)(lines s);(x:' ':y)#('|':z:w)=let p:q=y#w in case z of{'-'->p:' ':x:q;_->x:' ':p:q};x#_=x