#include #include using namespace std; int main() { int n, c1, c2; int k = 0; int o = 0; do { k = 0; o = 0; cin >> n >> c1 >> c2; while (n != 0) { if (n % 10 == c1) {o = o * 10 + c2; k++; n /= 10; } else { o = o * 10 + n % 10; n /= 10; } } while (o != 0) { n = n * 10 + o % 10; o /= 10; } if (n < 9) cout << n * pow(10, k); else cout << n; }while (n != 0); return 0; }