#include <iostream>
#include <string>

int main() {
    std::string s;
    std::string f;
    std::string r;

    std::getline(std::cin, s);
    std::getline(std::cin, f);
    std::getline(std::cin, r);

    size_t pos = s.find(f);
    while (pos != std::string::npos) {
        s.replace(pos, f.length(), r);
        pos = s.find(f);
    }

    std::cout << s << '\n';
}