#include <bits/stdc++.h>
using namespace std;

int main()
{
#ifndef ONLINE_JUDGE
   freopen ("input.txt", "r", stdin);
   freopen ("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s,a,b;
    long long vt;
    getline(cin,s);
    cin >> a >> b;
    vt = s.find(a);
    while (vt != -1)
    {
        s.replace(vt,a.size(),b);
        vt = s.find(a);
    }
    cout << s;
    return 0;
}