#include #include using namespace std; int main() { char n[100007]; char *p, *q, *y; bool ok = false; while (true) { cin.getline(n, 100007); ok = false; p = strtok(n, " "); q = strtok(NULL, " "); y = strtok(NULL, " "); if (p[0] == '0' && q[0] == '0' && y[0] == '0' ) { break; } for (int i = 0; i < strlen(n); i++) { if (p[i] == q[0]){ if (ok) { cout << y[0]; } } else { if (!ok && p[i] == '0') continue; cout << p[i]; ok = true; } } if (!ok && y[0] == '0') { cout << 0; } cout << "\n"; } cin.get(); return 0; }