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