#include <iostream>

using namespace std;

int main()
{
    unsigned int x, y, g, x1, y1;
    unsigned long long a = 0, h = 1, m = 1;
    cin>>x>>y;
    g = max(x,y);
    while (m<=g)
    {
        x1 = (x/m)%10;
        y1 = (y/m)%10;
        if (x1 != y1)
            a+=max(x1, y1)*h;
        else
        {
            if (x >= m)
            {
                a+=x1*h;
                if (y >= m)
                    h*=10;
            }
            if (y >= m)
            {
                a+=y1*h;
            }
        }
        h*=10;
        m*=10;
    }
    cout<<a;

    return 0;
}