#include #include #include #include using namespace std; int main() { string n; char c1, c2; int t = 0; while (t < 15) { cin >> n >> c1 >> c2; if (n == "0" && c1 == '0' && c2 == '0') { return 0; } else { for (long i = 0; i < strlen(n.c_str()); i++) { if (n[i] == c1) n[i] = c2; } cout << atoi(n.c_str()); } t++; } return 0; }