using System;

namespace Zadaci
{
    class Program
    {

        public static int pomoziMalojDanici(int a, int b)
        {
            int c = 0;

            int max = 0;
            int br = 1;

            if (a > b) max = a;
            else max = b;

            for (int i = 0; i < max.ToString().Length; i++)
            {
                int cifraA = a % 10;
                int cifraB = b % 10;

                c = c + returnMax(cifraA, cifraB)* br;

                a /= 10;
                b /= 10;
                br *= 10;
            }

            return c;
        }

        public static int returnMax(int a, int b)
        {
            if (a > b) return a;
            else return b;
        }


        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());

            Console.WriteLine();

            Console.WriteLine(pomoziMalojDanici(a,b));

            Console.ReadLine();
        }
    }
}