#include using namespace std; int main() { int n, c1, c2; int v[10]; while (1) { cin >> n >> c1 >> c2; if (n == 0 && c1 == 0 && c2 == 0) break; int k = 0; while (n) { v[++k] = n%10; n /= 10; } bool zero = false; while (k > 0) { int x; if (v[k] == c1) x = c2; else x = v[k]; if (x == 0 && zero) cout << 0; else if (x != 0) { cout << x; zero = true; } --k; } if (zero == false) cout << 0; cout << endl; } return 0; }