using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace tak._1
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = int.Parse(Console.ReadLine());
            int y = int.Parse(Console.ReadLine());
            int pomX, pomY;
            int noviBr= 0; int i = 1;
            if ((x < 1 || x > Math.Pow(10, 9)) || (y < 1 || y > Math.Pow(10, 9)))
            {
                Console.Error.WriteLine("GRESKA!");
                return;
            }

            while (x != -1 || y != -1)
            {
                pomX = x % 10;
                pomY = y % 10;
                if (pomX > pomY)
                {
                    noviBr += pomX * i;
                }
                else if (pomX == pomY)
                {
                    noviBr += pomX * i;
                    i *= 10;
                    noviBr += pomY * i;
                }
                else
                {
                    noviBr += pomY * i;
                }
                i *= 10;
                x /= 10;
                y /= 10;
                if (x == 0)
                    x = -1;
                if (y == 0)
                    y = -1;
            }
            Console.WriteLine(noviBr);
        }
    }
}