#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int pwr(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = (ans * 1LL * a) % mod;
    a = (a * 1LL * a) % mod;
    b >>= 1;
  }
  return ans;
}
const int N = 205;
const int M = 405;
int dp[N][N][M];
pair<pair<int, int>, int> par[N][N][M];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  string s, t;
  cin >> s >> t;
  int n = (int)(s).size(), m = (int)(t).size();
  s = '0' + s;
  t = '0' + t;
  s += "#";
  t += "#";
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      for (int k = 0; k <= M - 1; k++) {
        dp[i][j][k] = 1e9;
      }
    }
  }
  dp[0][0][0] = 0;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      for (int k = 0; k <= M - 1; k++) {
        if (dp[i][j][k] == 1e9) continue;
        if (k + 1 < M) {
          if (dp[i + (s[i + 1] == '(')][j + (t[j + 1] == '(')][k + 1] >
              1 + dp[i][j][k]) {
            dp[i + (s[i + 1] == '(')][j + (t[j + 1] == '(')][k + 1] =
                1 + dp[i][j][k];
            par[i + (s[i + 1] == '(')][j + (t[j + 1] == '(')][k + 1] = {{i, j},
                                                                        k};
          }
        }
        if (k > 0) {
          if (dp[i + (s[i + 1] == ')')][j + (t[j + 1] == ')')][k - 1] >
              1 + dp[i][j][k]) {
            dp[i + (s[i + 1] == ')')][j + (t[j + 1] == ')')][k - 1] =
                1 + dp[i][j][k];
            par[i + (s[i + 1] == ')')][j + (t[j + 1] == ')')][k - 1] = {{i, j},
                                                                        k};
          }
        }
      }
    }
  }
  string ans = "";
  int kk = 0;
  for (int k = 1; k <= M - 1; k++) {
    if (k + dp[n][m][k] < kk + dp[n][m][kk]) kk = k;
  }
  for (int i = 1; i <= kk; i++) {
    ans += ")";
  }
  while (n || m || kk) {
    auto x = par[n][m][kk];
    if (x.second < kk)
      ans += "(";
    else
      ans += ")";
    n = x.first.first, m = x.first.second, kk = x.second;
  }
  reverse(ans.begin(), ans.end());
  cout << ans;
  return 0;
}
