using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;


namespace ConsoleApp4
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            bool p = true;
            long z=0,i=1;
            long x = Convert.ToInt64(Console.ReadLine());
            long y = Convert.ToInt64(Console.ReadLine());
            if(x>=y)
            {
                while (x > 0)
                {
                    if (y == 0)
                        p = false;
                    if (x % 10 > y % 10)
                    {
                        z = z + (x % 10 * i);
                    }
                    else if (y % 10 > x % 10)
                    {
                        z = z + (y % 10 * i);
                    }
                    else if(p)
                    {
                        z = z + (x % 10 * i);
                        i = i * 10;
                        z = z + (x % 10 * i);
                    }
                    i = i * 10;
                    x /= 10;
                    y /= 10;
                } 
            }
            else
            {
                while (y > 0)
                {
                    if (x == 0)
                        p = false;

                    if (x % 10 > y % 10)
                    {
                        z = z + (x % 10 * i);
                    }
                    else if (y % 10 > x % 10)
                    {
                        z = z + (y % 10 * i);
                    }
                    else if(p)
                    {
                        z = z + (x % 10 * i);
                        i = i * 10;
                        z = z + (x % 10 * i);
                    }
                    i = i * 10;
                    x /= 10;
                    y /= 10;
                }
            }
            Console.WriteLine(z);    
        }

    }
}