#include #include #include using namespace std; int main() { string n; int c1, c2; while (cin >> n >> c1 >> c2) { if (n == "0" && c1 == 0 && c2 == 0) { break; } replace(n.begin(), n.end(), c1 + '0', c2 + '0'); char c = n[0]; while (c == '0') { n.erase(n.begin()); c = n[0]; } cout << n << "\n"; } return 0; }