#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <string.h>
#include <map>
#include <iterator>


using namespace std;

string x,y;
string pom;
long long int dokle;
string ostatak;
//string pom;

int main(){

    getline(cin, x);
    getline(cin, y);

    for(int i = 0; i < x.size()/2; i++){
        auto it = x[i];
        x[i] = x[x.size() - 1 - i];
        x[x.size() - 1 - i] = it;
    }

    for(int i = 0; i < y.size()/2; i++){
        auto it = y[i];
        y[i] = y[y.size() - 1 - i];
        y[y.size() - 1 - i] = it;
    }

    if(x.size() < y.size()){
        dokle = x.size();
        ostatak = y.substr(dokle, y.size());
    }

    else if(x.size() == y.size()){
        dokle = x.size();
    }
    else{
        dokle = y.size();
        ostatak = x.substr(dokle, x.size());
    }

     for(int i = 0; i < ostatak.size()/2; i++){
        auto it = ostatak[i];
        ostatak[i] = ostatak[ostatak.size() - 1 - i];
        ostatak[ostatak.size() - 1 - i] = it;
     }
    
    cout << ostatak;

    for(int i = dokle - 1; i >= 0; i--){
        if(x[i] < y[i]){
            cout << y[i];
        }
        else if(x[i] == y[i]){
            cout << x[i] << x[i];
        }
        else
           cout << x[i];
    }

   


    return 0;
}