#include <iostream>

using namespace std;

int main()
{
    long int x, y;
    int j1, j2, d1, d2, s1, s2, h1, h2, dh1, dh2, sh1, sh2, m1, m2, dm1, dm2, sm1, sm2, mi1, mi2, minj, mind, mins, minh, mindh, minsh, minm, mindm, minsm, minmi;
    cin >> x >> y;
    j1 = x % 10;
    x = x / 10;
    d1 = x % 10;
    x = x / 10;
    s1 = x % 10;
    x = x / 10;
    h1 = x % 10;
    x = x / 10;
    dh1 = x % 10;
    x = x / 10;
    sh1 = x % 10;
    x = x / 10;
    m1 = x % 10;
    x = x / 10;
    dm1 = x % 10;
    x = x / 10;
    sm1 = x % 10;
    x = x / 10;
    mi1 = x % 10;


    j2 = y % 10;
    y = y / 10;
    d2 = y % 10;
    y = y / 10;
    s2 = y % 10;
    y = y / 10;
    h2 = y % 10;
    y = y / 10;
    dh2 = y % 10;
    y = y / 10;
    sh2 = y % 10;
    y = y / 10;
    m2 = y % 10;
    y = y / 10;
    dm2 = y % 10;
    y = y / 10;
    sm2 = y % 10;
    y = y / 10;
    mi2 = y % 10;


    minj = max(j1, j2);
    mind = max(d1, d2);
    mins = max(s1, s2);
    minh = max(h1, h2);
    mindh = max(dh1, dh2);
    minsh = max(sh1, sh2);
    minm = max(m1, m2);
    mindm = max(dm1, dm2);
    minsm = max(sm1, sm2);
    minmi = max(mi1, mi2);

    if(j1 == j2 && j1 != 0)
        minj = j1 + j2 * 10;

    if(d1 == d2 && d1 != 0)
        mind = d1 + d2 * 10;

    if(s1 == s2 && s1 != 0)
        mins = s1 + s2 * 10;

    if(h1 == h2 && h1 != 0)
        minh = h1 + h2 * 10;

    if(dh1 == dh2 && dh1 != 0)
        mindh = dh1 + dh2 * 10;

    if(sh1 == sh2 && sh1 != 0)
        minsh = sh1 + sh2 * 10;

    if(m1 == m2 && m1 != 0)
        minm = m1 + m2 * 10;

    if(dm1 == dm2 && dm1 != 0)
        mindm = dm1 + dm2 * 10;

    if(sm1 == sm2 && sm1 != 0)
        minsm = sm1 + sm2 * 10;

    if(mi1 == mi2 && mi1 != 0)
        minmi = mi1 + mi2 * 10;

    if(mind == 0 && mins == 0 && minh == 0 && mindh == 0 &&  minsh == 0 && minm == 0 && mindm == 0 && minsm == 0 && minmi == 0 )
        cout << minj << endl;

    else if(mins == 0 && minh == 0 && mindh == 0 &&  minsh == 0 && minm == 0 && mindm == 0 && minsm == 0 && minmi == 0)
        cout << mind << minj << endl;

    else if(minh == 0 && mindh == 0 &&  minsh == 0 && minm == 0 && mindm == 0 && minsm == 0 && minmi == 0)
        cout << mins << mind << minj << endl;

    else if(mindh == 0 &&  minsh == 0 && minm == 0 && mindm == 0 && minsm == 0 && minmi == 0)
        cout << minh << mins << mind << minj << endl;

    else if(minsh == 0 && minm == 0 && mindm == 0 && minsm == 0 && minmi == 0)
        cout << mindh << minh << mins << mind << minj << endl;

    else if(minm == 0 && mindm == 0 && minsm == 0 && minmi == 0)
        cout << minsh << mindh << minh << mins << mind << minj << endl;

    else if(mindm == 0 && minsm == 0 && minmi == 0)
        cout << minm << minsh << mindh << minh << mins << mind << minj << endl;

    else if(minsm == 0 && minmi == 0 )
        cout << mindm << minm << minsh << mindh << minh << mins << mind << minj << endl;

    else if(minmi == 0)
        cout << minsm << mindm << minm << minsh << mindh << minh << mins << mind << minj << endl;
    else
        cout << minmi << minsm << mindm << minm << minsh << mindh << minh << mins << mind << minj << endl;

    return 0;
}