m@main=getLine>>=putStrLn.f.span('!'<)>>m f(a,s:b)=do(i,c)<-zip[0..]b;[s|elem i$read$'[':a++"]"]++[c]