import std.stdio;void main(){int b=0;char[] c,d,e;for(c=readln.dup;e=readln.dup,e;d=e)write(c);for(;d[++b]-75;){};for(;c[b]-84;)++c[b++];write(c);}