#include <iostream>
#include <cstring>
using namespace std;

char c1, c2;
char s[20];

int main()
{
    while(cin >> s >> c1 >> c2)
    {
        for(int i = 0; i < strlen(s); i++)
        {
            if(s[i] == c1) s[i] = c2;
        }
        cout << s << "\n";
    }
}