#include #include #include using namespace std; int main() { int n,c1,c2,i=0,j; char x[100]; while(cin >> n >> c1 >> c2) if(n==0 && c1==0 && c2==0) break; else { i=0; while(n) { if(n%10==c1) x[i++]=c2 +'0'; else x[i++]= n%10 +'0'; n=n/10; } strrev(x); cout << atoi(x) << '\n'; } return 0; }