#include #include using namespace std; string n; char c1, c2; void read (istream& in) { in >> n >> c1 >> c2; } int main() { read(cin); while (n != "0" || c1 != '0' || c2 != '0') { for (unsigned int i = 0 ; i < n.size(); ++i) if (n[i] == c1) n[i] = c2; unsigned int j; for (j = 0; j < n.size() && n[j] == '0'; ++j); n = n.substr(j, distance(n.begin()+j, n.end())); if (n == "") cout << "0\n"; else cout << n << "\n"; read(cin); } return 0; }