#include using namespace std; long long n,x,y; int main() { cin>>n>>x>>y; while(x || y || n ) { int pas=0; int aux[6]; while(n) { (n%10==x ? aux[pas++]=y : aux[pas++]=n%10); n/=10; } int n=0; if(aux[pas-1]) n=n*10+aux[pas-1]; for(int i=pas-2;i>=0;i--) n=n*10+aux[i]; cout<>n>>x>>y; } return 0; }