#include <iostream> #include <string> using namespace std; int main(){ string s; char c1,c2; while(cin>>s){ cin.get(); cin>>c1; cin.get(); cin>>c2; if(c1=='0'&&c2=='0'&&s[0]=='0'&&s.length()==1) break; for(int i=0;i<s.length();++i) if(s[i]==c1){ if(i>0||c2!='0') cout<<c2; } else cout<<s[i]; cout<<'\n'; } return 0; }