#include <bits/stdc++.h>

using namespace std;

int main()
{
    unsigned long long n, m, res = 0, brojac = 1;

    cin >> n >> m;

    while(n > 0 || m > 0){
        res += max(n%10, m%10)*brojac;
        brojac*=10;
        if(n % 10 == m % 10 && (n > 0 && m>0))
        {
            res+= n%10*brojac;
            brojac*=10;
        }
        n/=10;
        m/=10;
    }
    cout << res;
}