using System;

internal class Program
{
    public static string Reverse(string s)
    {
        char[] charArray = s.ToCharArray();
        Array.Reverse(charArray);
        return new string(charArray);
    }
    static void Main(string[] args)
    {
        int a, b;
        string str = "";

        a = int.Parse(Console.ReadLine());
        b = int.Parse(Console.ReadLine());
        int p = Math.Max(a, b);
        int k = Math.Min(a, b);
        a = p; b = k;

        if(b / 10 != 0)
        {
            while (a != 0)
            {
                if ((a % 10) == (b % 10))
                {
                    str += a % 10;
                    str += b % 10;
                }
                else if ((a % 10) > (b % 10))
                    str += a % 10;
                else
                    str += b % 10;


                a /= 10; b /= 10;
            }
        }
        else
        {
            while (a != 0)
            {
                if ((a % 10) > (b % 10))
                    str += a % 10;
                else
                    str += b % 10;

                a /= 10; b /= 10;
            }
        }

        
        str = Reverse(str);
        int c = int.Parse(str);
        Console.WriteLine(c);
    }
}