#include //#include using namespace std; int n, c1, c2, c, a[10], terminat, i, inceput; //fstream f ("test.in",ios::in); //fstream g("test.out", ios::out); int main() { terminat = 0; while (!terminat) { cin>>n>>c1>>c2; if ((n == 0) &&(c1 == 0) && (c2 == 0)) terminat = 1; else if ((n == 0) &&(c1 == 0)) cout << c2<< '\n'; else if (n == 0) cout << n << '\n'; else { c = 0; while (n!=0) { a[++c] = n % 10; n = n / 10; if (a[c] == c1) a[c] = c2; } inceput = 0; for (i = c; i >= 1; i--) { if (a[i]) inceput = 1; if (inceput) cout <