#include <bits/stdc++.h>
using namespace std;
int main() {
    int x,y;
    cin >>x>>y;

    long long z = 0;
    long long p = 1;
    while (x!=0 or y!=0){
        int cifraX = x %10;
        int cifraY = y %10;

        if (cifraX>cifraY)
            z=z+cifraX*p;
        else if (cifraY>cifraX)
            z=z+cifraY*p;
        else {
            if(x != 0 and y != 0){
            z=z+cifraX*p;
            p=p*10;
            }
            z=z+cifraX*p;

        }
        p=p*10;
        x = x/10;
        y = y/10;
    }
        cout <<z<<endl;
return 0;
}