#include <bits/stdc++.h>
using namespace std;
const int N = 205;
long long n1, n2, dp[N][N][N];
string s1, s2, s = "";
long long go(long long i, long long j, long long k) {
  if (k < 0 || k >= N) return 1e10;
  if (i == n1 && j == n2 && k == 0) return 0;
  long long &ans = dp[i][j][k];
  if (ans != -1) return ans;
  ans = 1e10;
  long long x, y;
  x = i;
  y = j;
  if (i < n1 && s1[i] == '(') x++;
  if (j < n2 && s2[j] == '(') y++;
  ans = min(ans, 1 + go(x, y, k + 1));
  x = i;
  y = j;
  if (i < n1 && s1[i] == ')') x++;
  if (j < n2 && s2[j] == ')') y++;
  ans = min(ans, 1 + go(x, y, k - 1));
  return ans;
}
void build(long long i, long long j, long long k) {
  long long x1, x2, y1, y2;
  x1 = x2 = i;
  y1 = y2 = j;
  if (s1[i] == '(') x1++;
  if (s2[j] == '(') y1++;
  if (s1[i] == ')') x2++;
  if (s2[j] == ')') y2++;
  if (i == n1 && j == n2 && k == 0) return;
  if (go(i, j, k) == (1 + go(x1, y1, k + 1))) {
    s += "(";
    build(x1, y1, k + 1);
  } else {
    s += ")";
    build(x2, y2, k - 1);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, i, j, x, y, t;
  cin >> s1 >> s2;
  n1 = s1.size();
  n2 = s2.size();
  memset(dp, -1, sizeof(dp));
  go(0, 0, 0);
  x = y = 0;
  if (s1[0] == '(') x++;
  if (s2[0] == '(') y++;
  build(0, 0, 0);
  cout << s;
}
