#include <bits/stdc++.h>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	string s, k;
	cin >> s >> k;
	reverse(s.begin(), s.end());
		reverse(k.begin(), k.end());
	vector<char> u;
		for(int i = 0; i < min(k.length(), s.length()); i++) {
			if(k[i] > s[i]) u.push_back(k[i]);
			else if(k[i] == s[i]) {
				u.push_back(k[i]);
				u.push_back(k[i]);
			}
			else u.push_back(s[i]);
		}
			reverse(s.begin(), s.end());
		reverse(k.begin(), k.end());
		if(s.length() > k.length()) {
			for(int i = 0; i < s.length() - k.length(); i++) cout<<s[i];
		}
		else for(int i = 0; i < k.length() - s.length(); i++) cout<<k[i];
		for(int i = u.size() - 1; i >= 0; i--) cout << u[i];


	
	return 0;
}