#include <iostream>
#include <string>
#include <bits/stdc++.h> 


using namespace std;

int main()
{
    int x,y,n,m,i;
    vector<char>a;
    cin>>x>>y;
    stringstream ss;
    ss << x;
    string sx = ss.str();
    stringstream sss;
    sss<<y;
    string sy=sss.str();
    n=sx.size();
    m=sy.size();
    if(n>m){
        for(i=1;i<=m;i++){
            if(sx[n-i]>=sy[m-i]){
                a.push_back(sx[n-i]);
            }
            if(sx[n-i]<=sy[m-i]){
                a.push_back(sy[m-i]);
            }
        }
        for(i=i;i<=n;i++){
            a.push_back(sx[n-i]);
        }
    }
    else{
        for(i=1;i<=n;i++){
            if(sx[n-i]>=sy[m-i]){
                a.push_back(sx[n-i]);
            }
            if(sx[n-i]<=sy[m-i]){
                a.push_back(sy[m-i]);
            }
        }
        for(i=i;i<=m;i++){
            a.push_back(sy[m-i]);
        }
    }
    for(i=a.size()-1;i>=0;i--){
        cout<<a[i];
    }
}