a,b,c=input(),input(),'' for x in a:c+=x;print(b.replace(c,'[%s]'%c,1))