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