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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            Console.WriteLine(sudar(a, b));
            Console.Read();
        }

        static int sudar(int a, int b)
        {
            if (a == 0 && b == 0) return 0;

            if (a%10 == b%10 && a != 0 && b != 0)
                return (a%10 * 10 + b%10) + sudar(a / 10, b / 10) * 100;
            else
                return Math.Max(a % 10, b % 10) + sudar(a / 10, b / 10) * 10;
        }
    }
}