#include <iostream>
using namespace std;
int main()
{
    int x, y, sudar = 0;
    int xcifre[100], ycifre[100], i, j, xy[100], n = 20, nxy = 0, p;
    cin >> x;
    cin >> y;
    for (int i = n - 1; i >= 0; i--)
    {
        xcifre[i] = x % 10;
        x /= 10;
    }
    for (int i = n - 1; i >= 0; i--)
    {
        ycifre[i] = y % 10;
        y /= 10;
    }
    for (i = 0; i < n; i++)
    {
        if (xcifre[i] > ycifre[i])
            xy[i] = xcifre[i];
        else
            xy[i] = ycifre[i];
        if (xcifre == ycifre)
        {
            for (j = i; j >= 0; j--)
            {
                xy[j - 1] = xy[j];
            }
            xy[i] = ycifre[i];
        }
    }
    for (j = 0; j < n; j++)
        sudar = 10 * sudar + xy[j];
    cout << sudar;
}