#include #include #include using namespace std; ifstream fin("comis.in"); ofstream fout("comis.out"); char n[100009]; int i, j; char c1, c2; int main(){ int ok = 1; while (ok){ cin >> n >> c1 >> c2; if (n[0] == '0' and c1 == '0' and c2 == '0') ok = 0; else { for (i = 0; n[i] != '\0'; i++) if (n[i] == c1) n[i] = c2; i = 0; while (n[i] == '0') i++; int okafis = 0; for (j = i; n[j] != '\0'; j++){ cout << n[j]; okafis = 1; } if (okafis == 0) cout << '0'; cout <<'\n'; } } }