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

namespace ConsoleApplication1
{
    class Program
    {
        static long brojCifara(long x)
        {
            if (x == 0)
                return 0;
            return 1 + (brojCifara(x / 10));
        }
        static void Main(string[] args)
        {
            long x = long.Parse(Console.ReadLine());
            long y = long.Parse(Console.ReadLine());
            double t = 0;
            long k = brojCifara(x);
            long f = brojCifara(y);
            double z = 1;
            if (k > f)
            {
                while (y > 0)
                {
                    if (x % 10 > y % 10)
                        t += x % 10 * z;
                    else if (x % 10 < y % 10)
                        t += y % 10 * z;
                    else
                    {
                        t += x % 10 * z;
                        z *= 10;
                        t += x % 10 * z;
                    }
                    x /= 10;
                    y /= 10;
                    z *= 10;
                }
                while (x > 0)
                {
                    t += x % 10 * z;
                    x /= 10;
                    z *= 10;
                }
            }
            else
            {
                while (x > 0)
                {
                    if (x % 10 > y % 10)
                        t += x % 10 * z;
                    else if (x % 10 < y % 10)
                        t += y % 10 * z;
                    else
                    {
                        t += x % 10 * z;
                        z *= 10;
                        t += x % 10 * z;
                    }
                    x /= 10;
                    y /= 10;
                    z *= 10;
                }
                while (y > 0)
                {
                    t += y % 10 * z;
                    y /= 10;
                    z *= 10;
                }
            }
            Console.WriteLine(t);
            Console.ReadLine();
        }
    }
}