#include<bits/stdc++.h>
using namespace std;
void solve() {
    long long x, y;
    int i = 1;
    long long n = 0;
    cin >> x >> y;
    while (x != 0 || y != 0) {
        if (x % 10 != y % 10) {
            n += i * max(x % 10, y % 10);
        }
        else {
            n += i * (x % 10);
            i *= 10;
            n += i * (x % 10);
        }
        i *= 10;
        x /= 10;
        y /= 10;
    }
    cout << n;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int tc = 1;
    // cin >> tc;
    for (int t = 1; t <= tc; t++) {
        // cout << "Case #" << t << ": ";
        solve();
    }
}