#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define mp make_pair #define pb push_back #define ff first #define ss second #define int64 unsigned long long int a[10]; int main(){ ios_base::sync_with_stdio(false); int n,c1,c2; while(true){ cin >> n >> c1 >> c2; if(n == c1 && c1 == c2 && n == 0) return 0; int m = 0; a[0] = 0; while(n != 0){ a[0]++; if(n%10 == c1) a[a[0]] = c2; else a[a[0]] = n%10; n /= 10; } while(a[a[0]] == 0 && a[0] > 1) a[0]--; for(int i = a[0]; i >= 1; i--) cout << a[i]; cout << "\n"; } }