r=raw_input;p,s=r(),r() t='' for c in p:t+=c;print s.replace(t,"[%s]"%t,1)