#include using namespace std; void Test (int N,int c1, int c2) { int V [15] = {0}; int cif,i=1; // Punem cifrele in vector in ordine inversa do { cif = N % 10; if (cif != c1) V[i] = cif; else V[i] = c2; i++; N/=10; }while(N); int ans = 0; for(int j= i; j>0; j--) { ans = ans * 10 + V[j]; } cout << ans << endl; } int main() { int a,b,c; cin >> a >> b >> c; while (a != 0 || b != 0 || c != 0) { Test(a,b,c); cin >> a >> b >> c; } return 0; }