#include #include using namespace std; int f, p; string n; char c1, c2; int main() { while(1){ cin >> n >> c1 >> c2; if(n=="0" && c1=='0' && c2=='0' && n[0]=='0') return 0; else{ for(int i=0; i<=n.size(); i++) if(n[i]==c1) n[i]=c2; if(n[0]=='0') n.erase(0, 1); } cout << n; } return 0; }