#include <iostream>
using namespace std;
int main()
{
string s;
getline(cin, s);
char a, b;
cin >> a >> b;
for (int i = 0; i < s.size(); i++)
{
if (s[i] == a)
cout << b;
else
cout << s[i];
}
return 0;
}