while 1:a,b,c=raw_input()[::-1].split();print a.replace(c,b,1)[::-1]