#include <bits/stdc++.h>
using namespace std;

int main() {
    int x, y; cin >> x >> y;
    string s = "";
    while (x || y) {
      s = (char)('0' + max(x % 10, y % 10)) + s;
      if (x % 10 == y % 10 && x && y) {
          s = (char)('0' + x % 10) + s;
      }
      x /= 10; y /= 10;
    }
    cout << s << endl;
}