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

namespace sudarbrojeva
{
    class Program
    {
        static void Main(string[] args)
        {
            int X, Y, pomX, pomY, brcifX=0, brcifY=0;
            int pom;
            int i= 0;
            X = Int32.Parse(Console.ReadLine());
            pomX = X;
            Y = Int32.Parse(Console.ReadLine());
            pomY = Y;
            while (pomX > 0)
            {
                pomX = pomX / 10;
                brcifX++;
            }
            while (pomY > 0)
            {
                pomY = pomY / 10;
                brcifY++;
            }
            int[] cifreX = new int[brcifX];
            int[] cifreY = new int[brcifY];
            for (i = 0; i < brcifX; i++)
                cifreX[i] = (X / (int)Math.Pow(10, i)) % 10;
            for (i = 0; i < brcifY; i++)
                cifreY[i] = (Y / (int)Math.Pow(10, i)) % 10;
            
            if(brcifX>brcifY)
                for( i=brcifX-1;i>=brcifY;i-- )
                    Console.Write(cifreX[i]);
            else
                for (i = brcifY-1; i >= brcifX; i--)
                    Console.Write(cifreY[i]);
            
            if (brcifX > brcifY)
                pom = brcifY;
            else
                pom = brcifX;
            for (i= pom-1; i >= 0; i--)
             {
                if (cifreX[i] == cifreY[i])
                {
                    Console.Write(cifreX[i]);
                    Console.Write(cifreX[i]); 
                }
                else if (cifreX[i] < cifreY[i])
                    Console.Write(cifreY[i]);
                else
                    Console.Write(cifreX[i]);
               }
        }
        }
    }