#include <bits/stdc++.h>
using namespace std;
const int N = 205;
struct three {
  int i, j, k;
  three() {}
  three(int _i, int _j, int _k) {
    i = _i;
    j = _j;
    k = _k;
  }
};
int dp[2 * N][N][N];
three trace[2 * N][N][N];
string s, t;
int n, m;
bool umax(int &a, int b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
void gogo() {
  cin >> s >> t;
  n = ((int)(s).size()), m = ((int)(t).size());
  s = ' ' + s, t = ' ' + t;
  for (int i = 0; i <= 400; ++i)
    for (int j = 0; j <= n; ++j)
      for (int k = 0; k <= 200; ++k) {
        dp[i][j][k] = -1;
      }
  dp[0][0][0] = 0;
  for (int i = 0; i <= 400; ++i) {
    for (int j = 0; j <= n; ++j) {
      for (int k = 0; k <= 200; ++k) {
        int cur = dp[i][j][k];
        if (cur == -1) continue;
        if (s[j + 1] == '(') {
          if (umax(dp[i + 1][j + 1][k + 1],
                   dp[i][j][k] + (t[cur + 1] == '('))) {
            trace[i + 1][j + 1][k + 1] = three(i, j, k);
          }
        } else {
          if (umax(dp[i + 1][j][k + 1], dp[i][j][k] + (t[cur + 1] == '('))) {
            trace[i + 1][j][k + 1] = three(i, j, k);
          }
        }
        if (k == 0) continue;
        if (s[j + 1] == ')') {
          if (umax(dp[i + 1][j + 1][k - 1],
                   dp[i][j][k] + (t[cur + 1] == ')'))) {
            trace[i + 1][j + 1][k - 1] = three(i, j, k);
          }
        } else {
          if (umax(dp[i + 1][j][k - 1], dp[i][j][k] + (t[cur + 1] == ')'))) {
            trace[i + 1][j][k - 1] = three(i, j, k);
          }
        }
      }
    }
  }
  int res = 1e9;
  for (int i = 0; i <= 2 * (n + m); ++i) {
    if (dp[i][n][0] >= m) {
      res = i;
      break;
    }
  }
  string ans = "";
  int i = res, j = n, k = 0;
  while (1) {
    three tmp = trace[i][j][k];
    if (k - tmp.k == 1)
      ans += '(';
    else
      ans += ')';
    i = tmp.i;
    j = tmp.j;
    k = tmp.k;
    if (i == 0) break;
  }
  reverse((ans).begin(), (ans).end());
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  if (fopen("sol"
            ".inp",
            "r")) {
    freopen(
        "sol"
        ".inp",
        "r", stdin);
    freopen(
        "sol"
        ".out",
        "w", stdout);
  }
  gogo();
  return 0;
}
