import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String s = "";
while (in.hasNextLine()) {
String str = in.nextLine();
if (str.equals("end")) {
break;
} else{
s += str;
}
}
String a = in.nextLine();
String b = in.nextLine();
System.out.print(s.replaceAll(a, b));
}
}