#include <iostream>

using namespace std;

int main(){
    long long x, y, resenje=0;
    cin>>x>>y;
    long long max;
    long long min;
    if(x>y){
    min=y;
    max=x;
    }if(y>x){
    max=y;
    min=x;
    }
    long long mamamia=1;
    while(max!=0){
        int br1=max%10;
        max/=10;
        if(min!=0){
            int br2=min%10;
            min/=10;
            if(br1>br2){
                resenje=resenje+br1*mamamia;
            }else if(br1<br2){
                resenje=resenje+br2*mamamia;
            }else{
                resenje=resenje+(br1*mamamia + br2*mamamia*10);
                mamamia=mamamia*10;
            }
        }else{
            resenje+=br1*mamamia;
        }
    mamamia*=10;
    }
    cout << resenje << endl;
}