#include <iostream>
using namespace std;

int main()
{
    unsigned long long  aa, bb, k = 0, n = 1;
    cin >> aa >> bb;
    if (aa < bb) swap(aa, bb);
    int i = 0;
    unsigned long long  pom = aa, pom1;
    while (pom / 10 > 0) { i++; pom = pom / 10;}
    i++;
    pom = aa; pom1 = bb;
    int a[1000000000], b[1000000000], sum[1000000000];
    for (int j = 0; j < i; j++)
    {
        a[j] = pom % 10; pom = pom / 10;
        b[j] = pom1 % 10; pom1 = pom1 / 10;
        if (pom1 == 0 && b[j] == 0) 
        {
            sum[k] = a[j]; k++;
        }
        else 
        {
            if (a[j] > b[j])
            {
                sum[k] = a[j]; k++;
            }
            if (a[j] < b[j])
            {
                sum[k] = b[j]; k++;
            }
            if (a[j] == b[j])
            {
                sum[k++] = a[j]; sum[k++] = b[j];
            }
        }
    }
    unsigned long long z = 0;
    for (int l = 0; l < k; l++)
    {
        z = z + n * sum[l];
        n *= 10;
    }
    cout << z;

}