#include <bits/stdc++.h>

using namespace std;

long long bigger_size(long long x,long long y){
    long long a=0,b=0;
    while(x>0){
        a++;
        x/=10;
    }
    while(y>0){
        b++;
        y/=10;
    }
    if(a>b||a==b){
        return a;
    }
    else{
        return b;
    }
}
long long smaller_size(long long x,long long y){
    long long a=0,b=0;
    while(x>0){
        a++;
        x/=10;
    }
    while(y>0){
        b++;
        y/=10;
    }
    if(a<b||a==b){
        return a;
    }
    else{
        return b;
    }
}

string ll_to_str(long long x,long long s){
    string a="";
    while (x>0){
        a+=(char)(x%10+48);
        x/=10;
        s--;
    }
    while(s>0){
        a+='0';
        s--;
    }
    return a;
}
string result(string x,string y,long long c){
    string z="";
    int i=x.size()-1;
    while(i>=0){
        if((long long)(x[i])>(long long)(y[i])){
            z+=x[i];
            c--;
        }
        else if((long long)(y[i])>(long long)(x[i])){
            z+=y[i];
            c--;
        }
        else{
            if(c<=0&&i!=0){
                z+=x[i];
            }
            else{
                z+=x[i];z+=y[i];
            }
            c--;
        }
        i--;
    }
    return z;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long X,Y;
    string x,y;
    cin>>X>>Y;
    x=ll_to_str(X,bigger_size(X,Y));
    y=ll_to_str(Y,bigger_size(X,Y));
    cout<<result(x,y,smaller_size(X,Y));

    return 0;
}