#include <stdio.h>
#include <stdlib.h>

int jed(int a)
{
    int jed=a%10;
}
int des(int a)
{
    int des=(a%100)/10;
}
int st(int a)
{
    int st=(a%1000)/100;
}
int hilj(int a)
{
    int hilj=(a%10000)/1000;
}
int dhilj(int a)
{
    int dhilj=(a%100000)/10000;
}
int sthilj(int a)
{
    int sthilj=(a%1000000)/100000;
}
int main()
{
    int x,y,j,d,s,h,dh,sh,m;
    scanf("%d%d",&x,&y);
    if(jed(x)>jed(y))  j=jed(x);    else        j=jed(y);
    if(des(x)>des(y))  d=des(x);    else        d=des(y);
    if(st(x)>st(y))    s=st(x);    else        s=st(y);
    if(hilj(x)>hilj(y)) h=hilj(x);  else        h=hilj(y);
    if(dhilj(x)>dhilj(y))  dh=dhilj(x);   else   dh=dhilj(y);
    if(sthilj(x)>sthilj(y))    sh=sthilj(x);   else   sh=sthilj(y);

    if (jed(x)==jed(y) && jed(x)!=0 ) j=jed(x)+jed(y)*10;
    if (des(x)==des(y) && des(x)!=0) d=des(x)+des(y)*10;
    if (st(x)==st(y) && st(x)!=0) s=st(x)+st(y)*10;
    if (hilj(x)==hilj(y) && hilj(x)!=0 && hilj(y)!=0) h=hilj(x)+hilj(y)*10;
    if (dhilj(x)==dhilj(y) && dhilj(x)!=0 && dhilj(y)!=0) dh=dhilj(x)+dhilj(y)*10;
    if (sthilj(x)==sthilj(y) && sthilj(x)!=0 && sthilj(y)!=0) sh=sthilj(x)+sthilj(y)*10;


    if (sh!=0)  printf("%d%d%d%d%d%d",sh,dh,h,s,d,j);
    if (sh==0 && dh!=0)  printf("%d%d%d%d%d",dh,h,s,d,j);
    if (sh==0 && dh==0 && h!=0)  printf("%d%d%d%d",h,s,d,j);
    if (sh==0 && dh==0 && h==0 && s!=0)  printf("%d%d%d",s,d,j);
    if (sh==0 && dh==0 && h==0 && s==0 && d!=0)  printf("%d%d",d,j);


    return 0;
}