#include<iostream> #include<cstdio> #include<string> using namespace std; int main() { string str, str1, str2, temp; int low, high; while (getline(cin, str)) { getline(cin, str1); getline(cin, str2); low = high = 0; while (high < str.size()) { while (str[high] != ' ' && high < str.size())++high; temp=str.substr(low, high - low); if (str1 == temp) { str.erase(low, high - low); str.insert(low, str2); } else { low = ++high; } } cout<<str<<endl; } return 0; }