#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
string str;
string a, b;
getline(cin, str); // 注意 while 处理多个 case
vector<string>v;
for (int i = 0; i < str.size() ; ) {
int j = i + 1;
for (; j < str.size() && str[j] != ' '; ++j);
v.push_back(string(&str[i], &str[j]));
i = j + 1;
}
cin >> a >> b;
if (v[0] == a)
cout << b;
else
cout << v[0];
for (int i = 1; i < v.size(); ++i) {
cout << " " << (v[i] == a ? b : v[i]);
}
}
// 64 位输出请用 printf("%lld")

京公网安备 11010502036488号