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

const int maxn = 4e3+5;
char s[maxn], t[maxn];
int n, m, dp[maxn][maxn], nxt[maxn][maxn], nxts[maxn][2], nxtt[maxn][2]; 

int solve(int i, int j){
	if (i == n+2 && j == m+2) return 0;
	if (dp[i][j] != -1) return dp[i][j];
	int ret = dp[i][j] = maxn;
	for(int x = 0; x<=1; x++) {
		ret = 1 + solve(nxts[i][x]+1, nxtt[j][x]+1);
		if (ret < dp[i][j]) dp[i][j] = ret, nxt[i][j] = x;
	}
	return dp[i][j];
}

void reconstruct(int i, int j){
	if (i == n+2 && j == m+2) return;
	int x = nxt[i][j];
	printf("%d", x);
	reconstruct(nxts[i][x]+1, nxtt[j][x]+1);
}

int main(){
	scanf("%s", s+1);
	scanf("%s", t+1);
	n = strlen(s+1), m = strlen(t+1);
	for(int x = 0; x<=1; x++) {
		nxts[n+1][x] = nxts[n+2][x] = n+1;
		nxtt[m+1][x] = nxtt[m+2][x] = m+1;
	}
	for(int i = n; i>=0; i--){ 
		for(int x = 0; x<=1; x++){
			nxts[i][x] = (s[i] == '0'+x) ? i : nxts[i+1][x];
		}
	}

	for(int i = m; i>=0; i--){
		for(int x = 0; x<=1; x++){
			nxtt[i][x] = (t[i] == '0'+x) ? i : nxtt[i+1][x];
		}
	}

	memset(dp, -1, sizeof(dp));
	solve(0, 0);
	reconstruct(0, 0);
	puts("");
	return 0;
}
