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

string A, B;
int memo[4002][4002];
int prev_bin[4002][4002];

int next_A[2][4002];
int next_B[2][4002];

int dfs(ui i, ui j) {
	i = min(ui(A.size()), i);
	j = min(ui(B.size()), j);
	if (memo[i][j] != -1) return memo[i][j];
	{
		// use 0
		ui ni = i, nj = j;
		if (ni < A.size()) ni = next_A[0][ni];
		if (nj < B.size()) nj = next_B[0][nj];
		if(A.size() <= ni && B.size() <= nj) {
			memo[i][j] = 1;
			prev_bin[i][j] = 0;
		}else {
			memo[i][j] = 1 + dfs(ni + 1, nj + 1);
			prev_bin[i][j] = 0;
		}
	}
	{
		// use 1
		ui ni = i, nj = j;
		if (ni < A.size()) ni = next_A[1][ni];
		if (nj < B.size()) nj = next_B[1][nj];
		if (A.size() <= ni && B.size() <= nj) {
			if(memo[i][j] > 1) {
				memo[i][j] = 1;
				prev_bin[i][j] = 1;
			}
		} else {
			int res = 1 + dfs(ni + 1, nj + 1);
			if (memo[i][j] > res) {
				memo[i][j] = res;
				prev_bin[i][j] = 1;
			}
		}
	}
	return memo[i][j];
}

int main() {
	cin >> A >> B;
	memset(memo, -1, sizeof(memo));

	for(int i=0;i<A.size();i++) {
		{
			int ni = i;
			while (ni < A.size() && A[ni] != '0') ni++;
			next_A[0][i] = ni;
		}
		{
			int ni = i;
			while (ni < A.size() && A[ni] != '1') ni++;
			next_A[1][i] = ni;
		}
	}

	for (int j = 0; j<B.size(); j++) {
		{
			int nj = j;
			while (nj < B.size() && B[nj] != '0') nj++;
			next_B[0][j] = nj;
		}
		{
			int nj = j;
			while (nj < B.size() && B[nj] != '1') nj++;
			next_B[1][j] = nj;
		}
	}

	int n = dfs(0, 0);

	ui i = 0, j = 0;
	for(int k=0;k<n;k++) {
		int c = prev_bin[i][j];
		cout << prev_bin[i][j];
		if (i < A.size()) i = next_A[c][i];
		if (j < B.size()) j = next_B[c][j];
		i = min(i + 1, ui(A.size()));
		j = min(j + 1, ui(B.size()));
	}
	cout << endl;

	return 0;
}

