r=raw_input;p=r();q=r();d='' for c in p:d+=c;print"%s[%s]%s"%q.rpartition(d)