#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
typedef unsigned long long ull;
int bc(int n) {
    int c = 0;
    while (n != 0) {
        n = n / 10;
        c++;
    }
    return c;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ull x, y, z;
    int x1[11], y1[11], z1[23];
    cin >> x >> y;
    int i, j;
    int bcx, bcy;
    for (i = 0; i <= 9; i++)
    {
        x1[i] = x / pow(10, i);
        x1[i] = x1[i] % 10;
        y1[i] = y / pow(10, i);
        y1[i] = y1[i] % 10;
    }
    bcx = bc(x);
    bcy = bc(y);
    j = 0;
    for (i = 0; i <= 9; i++)
    {
        if (x1[i] > y1[i]||bcy<i+1)
            z1[j] = x1[i];
        else if (x1[i] < y1[i]|| bcx < i + 1)
            z1[j] = y1[i];
        else
        {
            z1[j] = x1[i];
            j++;
            z1[j] = y1[i];
        }
        j++;
    }
    z = 0;
    for (i = 0; i < j; i++)
    {
        z += z1[i] * pow(10, i);
    }
    cout << z;
}