#include <iostream>
#include <string>
#define inf 30000

using namespace std;

int S, T;
string s, t;
int succS[4005][2], succT[4005][2];
short dp[4005][4005], dp2[4005][4005];

void calc(string &s, int succ[4005][2])
{
	int n = (int)s.size() - 1;
	int nx[2] = {n+1, n+1};
	succ[n+1][0] = succ[n+1][1] = n+1;
	for(int i = n; i >= 0; i--){
		for(int j = 0; j < 2; j++){
			succ[i][j] = nx[j];
		}
		if(i > 0) nx[s[i]-'0'] = i;
	}
}

int main(void)
{
	cin >> s >> t;
	S = s.size(), T = t.size();
	s = "#" + s, t = "#" + t;
	
	calc(s, succS), calc(t, succT);
	
	for(int i = 0; i <= S+1; i++){
		for(int j = 0; j <= T+1; j++){
			dp[i][j] = inf;
		}
	}
	dp[0][0] = 0;
	
	for(int i = 0; i <= S+1; i++){
		for(int j = 0; j <= T+1; j++){
			if(i == S+1 && j == T+1) continue;
			for(int k = 0; k < 2; k++){
				int ni = succS[i][k];
				int nj = succT[j][k];
				dp[ni][nj] = min(dp[ni][nj], (short)(dp[i][j] + 1));
			}
		}
	}
	int dist = dp[S+1][T+1];
	
	dp2[S+1][T+1] = 0;
	for(int i = S+1; i >= 0; i--){
		for(int j = T+1; j >= 0; j--){
			if(i == S+1 && j == T+1) continue;
			dp2[i][j] = inf;
			for(int k = 0; k < 2; k++){
				int ni = succS[i][k];
				int nj = succT[j][k];
				dp2[i][j] = min(dp2[i][j], (short)(dp2[ni][nj] + 1));
			}
		}
	}
	
	int pi = 0, pj = 0; string ans;
	while(pi != S+1 || pj != T+1){
		for(int k = 0; k < 2; k++){
			int ni = succS[pi][k];
			int nj = succT[pj][k];
			if(dp[ni][nj] > dp[pi][pj] && dp[ni][nj] + dp2[ni][nj] == dist){
				pi = ni, pj = nj;
				ans += (char)(k+'0');
				break;
			}
		}
	}
	cout << ans << endl;
	
	return 0;
}
