i=raw_input q=i() s=i() w="" for a in q:w+=a;print'%s[%s]%s'%s.rpartition(w)