long x, y;
x=long.Parse(Console.ReadLine());
y=long.Parse(Console.ReadLine());
long jx = x % 10;
long dx = x / 10 % 10;
long sx=x / 100 % 10;
long hx=x / 1000 % 10;
long dhx=x / 10000 % 10;
long shx = x / 100000 % 10;
long mx = x / 1000000 % 10;
long smx = x / 10000000 % 10;
long hmx = x / 100000000 % 10;
long mmx = x / 1000000000 % 10;
long jy = y % 10;
long dy = y / 10 % 10;
long sy = y / 100 % 10;
long hy = y / 1000 % 10;
long dhy = y / 10000 % 10;
long shy = y / 100000 % 10;
long my = y / 1000000 % 10;
long smy = y / 10000000 % 10;
long hmy = y / 100000000 % 10;
long mmy = y / 1000000000 % 10;
if(x<10 && y<10)
{
    if (jx > jy)
        Console.WriteLine(jx);
    else if (jy > jx)
        Console.WriteLine(jy);
    else
        Console.WriteLine(jy + jx * 10);
}
if(x>10 && x<100 && y < 10)
{
    if (jx > jy)
        Console.WriteLine(jx + dx * 10);
    else if (jy > jx)
        Console.WriteLine(jy + dx * 10);
    else
        Console.WriteLine(jy + jx * 10 + dx * 100);
}
if (x < 10 && y > 10 && y < 100)
{
    if (jx > jy)
        Console.WriteLine(jx + dy * 10);
    else if (jy > jx)
        Console.WriteLine(jy + dy * 10);
    else
        Console.WriteLine(jy + jx * 10 + dy * 100);
}
if (y>10 && y<100 && x>10 && x < 100)
{
    if (jx > jy && dx > dy)
        Console.WriteLine(jx + dx * 10);
    else if (jx < jy && dx > dy)
        Console.WriteLine(jy + dx * 10);
    else if (jx > jy && dx < dy)
        Console.WriteLine(jx + dy * 10);
    else if (jx.Equals(jy) && dx > dy)
        Console.WriteLine(jy + jx * 10 + dx * 100);
    else if (jx.Equals(jy) && dx < dy)
        Console.WriteLine(jy + jx * 10 + dy * 100);
    else if (dx.Equals(dy) && jx > jy)
        Console.WriteLine(jx + dx * 10 + dx * 100);
    else if (dx.Equals(dy) && jx < jy)
        Console.WriteLine(jy + dx * 10 + dx * 100);
    else if (dx.Equals(dy) && jx.Equals(jy))
        Console.WriteLine(jx + jx * 10 + dx * 100 + dx * 1000);
    else
        Console.WriteLine(jy + dy * 10);
}
if(x>100 && x<1000 && y>10 && y < 100)
{
    if (jx > jy && dx > dy)
        Console.WriteLine(jx + dx * 10+sx*100);
    else if (jx < jy && dx > dy)
        Console.WriteLine(jy + dx * 10+sx*100);
    else if (jx > jy && dx < dy)
        Console.WriteLine(jx + dy * 10+sx*100);
    else if (jx.Equals(jy) && dx > dy)
        Console.WriteLine(jy + jx * 10 + dx * 100+sx*1000);
    else if (jx.Equals(jy) && dx < dy)
        Console.WriteLine(jy + jx * 10 + dy * 100+sx*1000);
    else if (dx.Equals(dy) && jx > jy)
        Console.WriteLine(jx + dx * 10 + dx * 100+sx*1000);
    else if (dx.Equals(dy) && jx < jy)
        Console.WriteLine(jy + dx * 10 + dx * 100+sx*1000);
    else if (dx.Equals(dy) && jx.Equals(jy))
        Console.WriteLine(jx + jx * 10 + dx * 100 + dx * 1000+sx*10000);
    else
        Console.WriteLine(jy + dy * 10+sx*100);
}
if (x < 100 && x > 10 && y > 100 && y < 1000)
{
    if (jx > jy && dx > dy)
        Console.WriteLine(jx + dx * 10 + sy * 100);
    else if (jx < jy && dx > dy)
        Console.WriteLine(jy + dx * 10 + sy * 100);
    else if (jx > jy && dx < dy)
        Console.WriteLine(jx + dy * 10 + sy * 100);
    else if (jx.Equals(jy) && dx > dy)
        Console.WriteLine(jy + jx * 10 + dx * 100 + sy * 1000);
    else if (jx.Equals(jy) && dx < dy)
        Console.WriteLine(jy + jx * 10 + dy * 100 + sy * 1000);
    else if (dx.Equals(dy) && jx > jy)
        Console.WriteLine(jx + dx * 10 + dx * 100 + sy * 1000);
    else if (dx.Equals(dy) && jx < jy)
        Console.WriteLine(jy + dx * 10 + dx * 100 + sy * 1000);
    else if (dx.Equals(dy) && jx.Equals(jy))
        Console.WriteLine(jx + jx * 10 + dx * 100 + dx * 1000 + sy * 10000);
    else
        Console.WriteLine(jy + dy * 10 + sy * 100);
}
if (x > 100 && x < 1000 && y > 100 && y < 1000)
{
    if (jx > jy && dx > dy && sx > sy)
        Console.WriteLine(jx + dx * 10 + sx * 100);
    else if (jx < jy && dx > dy && sx > sy)
        Console.WriteLine(jy + dx * 10 + sx * 100);
    else if (jx > jy && dx < dy && sx > sy)
        Console.WriteLine(jx + dy * 10 + sx * 100);
    else if (jx.Equals(jy) && dx > dy && sx > sy)
        Console.WriteLine(jy + jx * 10 + dx * 100 + sx * 1000);
    else if (jx.Equals(jy) && dx < dy && sx > sy)
        Console.WriteLine(jy + jx * 10 + dy * 100 + sx * 1000);
    else if (dx.Equals(dy) && jx > jy && sx > sy)
        Console.WriteLine(jx + dx * 10 + dx * 100 + sx * 1000);
    else if (dx.Equals(dy) && jx < jy && sx > sy)
        Console.WriteLine(jy + dx * 10 + dx * 100 + sx * 1000);
    else if (dx.Equals(dy) && jx.Equals(jy) && sx > sy)
        Console.WriteLine(jx + jx * 10 + dx * 100 + dx * 1000 + sx * 10000);
    else if (jx > jy && dx > dy && sx < sy)
        Console.WriteLine(jx + dx * 10 + sy * 100);
    else if (jx < jy && dx > dy && sx < sy)
        Console.WriteLine(jy + dx * 10 + sy * 100);
    else if (jx > jy && dx < dy && sx < sy)
        Console.WriteLine(jx + dy * 10 + sy * 100);
    else if (jx.Equals(jy) && dx > dy && sx < sy)
        Console.WriteLine(jy + jx * 10 + dx * 100 + sy * 1000);
    else if (jx.Equals(jy) && dx < dy && sx < sy)
        Console.WriteLine(jy + jx * 10 + dy * 100 + sy * 1000);
    else if (dx.Equals(dy) && jx > jy && sx < sy)
        Console.WriteLine(jx + dx * 10 + dx * 100 + sy * 1000);
    else if (dx.Equals(dy) && jx < jy && sx < sy)
        Console.WriteLine(jy + dx * 10 + dx * 100 + sy * 1000);
    else if (dx.Equals(dy) && jx.Equals(jy) && sx < sy)
        Console.WriteLine(jx + jx * 10 + dx * 100 + dx * 1000 + sy * 10000);
    else if (jx.Equals(jy) && dx > dy && sx.Equals(sy))
        Console.WriteLine(jx + jx * 10 + dx * 100 + sx * 1000 + sx * 10000);
    else if(jx>jy&& dx.Equals(dy)&& sx.Equals(sy))
        Console.WriteLine(jx + dx * 10 + dx * 100 + sx * 1000 + sx * 10000);
    else if(jx.Equals(jy)&&dx.Equals(dy)&&sx.Equals(sy))
        Console.WriteLine(jx + jx * 10 + dx * 100 + dx * 1000 + sx * 10000+sx*100000);
    else if (jx.Equals(jy) && dx < dy && sx.Equals(sy))
        Console.WriteLine(jx + jx * 10 + dy * 100 + sx * 1000 + sx * 10000);
    else if (jx < jy && dx.Equals(dy) && sx.Equals(sy))
        Console.WriteLine(jy + dx * 10 + dx * 100 + sx * 1000 + sx * 10000);
    else
        Console.WriteLine(jy + dy * 10 + sy * 100);
}