#include <string> #include <iostream> using namespace std; int string_to_int(string s){ int x = 0; for(int i=0; i<(int)s.size(); i++){ x = 10*x+(s[i]-48); } return x; } int main(){ string s; char c1, c2; while(!cin.eof()){ cin>>s>>c1>>c2; if(cin.eof()){ break; } if(c1 == c2){ if(c1 != '0' || s.compare("0") != 0){ cout<<s; } continue; } for(int i=0; i<(int)s.size(); i++){ if(s[i] == c1){ s[i] = c2; } } cout<<string_to_int(s); } return 0; }