char R[99],G[99],*r,*g,m;
main(c){
	for(;scanf("%s%s\n",R,G),*R!='-';){
		r=R,g=G;
		m=*g++;
		for(;c=getchar(),c!='\n';){
			while(c!=m){
				putchar(m);
				m=*g++;
			}
			m=*r++;
		}
		putchar(m);
		puts(g);
	}
	exit(0);
}