#include <stdio.h>

using namespace std;

int main()
{
    unsigned long long int x,y,rez=0;
    scanf("%d%d",&x,&y);
    for(;x>0||y>0;x/=10,y/=10)
    {
        rez=rez*10+min(x%10,y%10);
        if(x%10==y%10&&(x!=0||y!=0)) rez=rez*10+x%10;
    }
    printf("%d",rez);
    return 0;
}