#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios::sync_with_stdio(0);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const int MAN = 210;
int dp[MAN][MAN][MAN];
tuple<int, int, int> pred[MAN][MAN][MAN];
int INF = 1e9;
signed main() {
  fast();
  int n1, n2, i, j, n2i, n2j, a, b, c, d, bal, ni, nj;
  string s1, s2;
  cin >> s1 >> s2;
  char sk;
  n1 = ((int)s1.size());
  n2 = ((int)s2.size());
  s1 = '#' + s1;
  s2 = '#' + s2;
  for (i = 0; i <= n1; i++)
    for (j = 0; j <= n2; j++)
      for (bal = 0; bal < MAN; bal++) dp[i][j][bal] = INF;
  dp[0][0][0] = 0;
  for (i = 0; i <= n1; i++) {
    for (j = 0; j <= n2; j++) {
      for (bal = 0; bal < MAN; bal++) {
        if (dp[i][j][bal] == INF) continue;
        ni = i + (i + 1 <= n1 && s1[i + 1] == '(');
        nj = j + (j + 1 <= n2 && s2[j + 1] == '(');
        if (bal + 1 < MAN && dp[ni][nj][bal + 1] > dp[i][j][bal] + 1) {
          dp[ni][nj][bal + 1] = dp[i][j][bal] + 1;
          pred[ni][nj][bal + 1] = make_tuple(i, j, bal);
        }
        ni = i + (i + 1 <= n1 && s1[i + 1] == ')');
        nj = j + (j + 1 <= n2 && s2[j + 1] == ')');
        if (bal - 1 >= 0 && dp[ni][nj][bal - 1] > dp[i][j][bal] + 1) {
          dp[ni][nj][bal - 1] = dp[i][j][bal] + 1;
          pred[ni][nj][bal - 1] = make_tuple(i, j, bal);
        }
      }
    }
  }
  int balmi = INF;
  for (i = 0; i < MAN; i++) {
    if (dp[n1][n2][i] + i < balmi) balmi = i;
  }
  string ans = "";
  for (i = 0; i < balmi; i++) {
    ans += ')';
  }
  i = n1;
  j = n2;
  bal = balmi;
  int i2, j2, bal2;
  while (pred[i][j][bal] != make_tuple(0, 0, 0)) {
    tie(i2, j2, bal2) = pred[i][j][bal];
    if (bal2 < bal)
      ans += '(';
    else
      ans += ')';
    i = i2;
    j = j2;
    bal = bal2;
  }
  ans += '(';
  for (i = ((int)ans.size()) - 1; i >= 0; i--) cout << ans[i];
  return 0;
}
