#include #include using namespace std; int main() { char s[100]; int c1, c2; // freopen("fis.in", "r", stdin); // freopen("fis.out", "w", stdout); scanf("%s %d %d\n", s, &c1, &c2); while (c1 != 0 || c2 != 0 || strcmp(s, "0")) { for (int i = 0; i < strlen(s); i++) { if (s[i] == c1 + '0') { s[i] = c2 + '0'; } } int i; for (i = 0; s[i] == '0' && i < strlen(s) - 1; i++); for (; i < strlen(s); i++) { printf("%c", s[i]); } printf("\n"); scanf("%s %d %d\n", s, &c1, &c2); } return 0; }