#include <iostream>
using namespace std;

int main()
{
    int x, y;
    cin >> x >> y;
    int naj = max(x, y);
    int dr = min(x, y);
    long long int novbr = 0;
    long long int dec = 1;
    while (naj > 0) {
        int c1 = naj % 10;
        if (dr > 0) {
            int c2 = dr % 10;
            if (c1 > c2) {
                novbr += c1 * dec;
            }
            else if (c2 > c1) {
                novbr += c2 * dec;
            }
            else {

                novbr = novbr + c1 * dec;
                dec = dec * 10;
                novbr = novbr + c1 * dec;
            }
            dr = dr / 10;
        }
        else {
            novbr += c1 * dec;
        }
        naj = naj / 10;
        dec = dec * 10;

    }
    cout << novbr;
  
}