#include #include #include using namespace std; int main() { ifstream f("input.txt"); ofstream g("output.txt"); int n,c1,c2,k=0,uc,v[100],i,c,nr,inv=0,j=0; f>>n>>c1>>c2; c=n;nr=0; while(c) { uc=c%10; if(uc==c1) nr=nr*10+c2; else nr=nr*10+uc; c=c/10; } while(nr) { uc=nr%10; inv=inv*10+uc; nr=nr/10; } g<>n>>c1>>c2; if(n==0 && c1==0 && c2==0) break; c=n;inv=0;j=0; while(c) { uc=c%10; if(uc==c1 && c2==0) { nr=nr*10+c2; if(c>9) j++; } else nr=nr*10+uc; c=c/10; } while(nr) { uc=nr%10; inv=inv*10+uc; nr=nr/10; } if(j==0) g<