# include using namespace std; # define fi cin # define fo cout char a[555]; int main(void) { char x,y; while (fi>>(a+1)>>x>>y) { if (a[1] == '0' && x == '0' && y == '0') break; long long p = 0; for (int i=1;a[i];++i) p = p * 10 + (a[i] == x ? y:a[i]) - '0'; fo << p << '\n'; } return 0; }