BEGIN{FS=OFS=b}{for(i=1;i<=NF;i++){if(u=index("({[",$i))a[n++]=substr(")}]",u,1) if($i=="?")$i=a[--n]}}1