#include <iostream>
#include <string>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    string n,k;
    cin >>n;
    cin >> k;
    int firstlen = n.size();
    int secondlen = k.size();
    int minn = min(firstlen,secondlen);
    string shorter, longer;
    if(minn == firstlen){
        shorter = n;
        longer = k;
    }
    else{
        if(minn == secondlen){
             shorter = k;
            longer = n;
        }

    }
    string res = "";
    int diff = longer.size() - shorter.size();
    for(int i = minn - 1; i >=0; i--){

       // cout << "shorter : " << shorter[i] << '\n';
       // cout << "longer : " << longer[i+diff] << '\n';
        if(int(shorter[i]) > int(longer[i+diff])){
            res = res + shorter[i];
        }
        else{
            if(int(shorter[i]) < int(longer[i+diff])){
                res += longer[i+diff];
            }
            else{
                if(shorter[i]==longer[i+diff]){
                    res+=shorter[i];
                    res+=longer[i+diff];
                }
            }
        }
    }
    reverse(res.begin(), res.end());
    string r1 = res;
    if(firstlen != secondlen){
        string r = longer.substr(0, longer.size() - shorter.size());
        r += res;
        r1=r;
    }
    cout << r1;
    return 0;
}