//土尔逊Torson 编写于2023/4/19
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <stdlib.h>

using namespace std;

int main() {
	string s, a, b;
	getline(cin, s);
	getline(cin, a);
	getline(cin, b);
	s = " " + s + " ";
    a = " " + a + " ";
    b = " " + b + " ";
	int start;
	while (1) {
		start = s.find(a);
		if (start == string::npos) {
			break;
		}
		else {
			s.erase(start, a.length());
			s.insert(start, b);
		}

	}
	s = s.substr(1, s.size() - 2);
	printf("%s\n", s.c_str());
	system("pause");
	return EXIT_SUCCESS;
}
// 64 位输出请用 printf("%lld")