while 1: y=' ';s,a=raw_input().split(y,1) for x in a+y:s=s.replace(x,y);y=x print s