#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
struct node {
  int i, j, bal;
  char scoba;
  node() {}
  node(long long _i, long long _j, long long _k, char _scoba)
      : i(_i), j(_j), bal(_k), scoba(_scoba) {}
};
node p[210][210][410];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s, t;
  cin >> s >> t;
  long long n = s.size(), m = t.size();
  vector<vector<vector<long long> > > dp(
      n + 1, vector<vector<long long> >(m + 1, vector<long long>(410, inf)));
  dp[0][0][0] = 0;
  for (long long i = 0; i <= n; ++i) {
    for (long long j = 0; j <= m; ++j) {
      for (long long k = 0; k <= 410; ++k) {
        if (dp[i][j][k] == inf) continue;
        long long nxti = i + (i < n && s[i] == '('),
                  nxtj = j + (j < m && t[j] == '(');
        if (k + 1 < 410 && dp[nxti][nxtj][k + 1] > dp[i][j][k] + 1) {
          dp[nxti][nxtj][k + 1] = dp[i][j][k] + 1;
          p[nxti][nxtj][k + 1] = node(i, j, k, '(');
        }
        nxti = i + (i < n && s[i] == ')'), nxtj = j + (j < m && t[j] == ')');
        if (k > 0 && dp[nxti][nxtj][k - 1] > dp[i][j][k] + 1) {
          dp[nxti][nxtj][k - 1] = dp[i][j][k] + 1;
          p[nxti][nxtj][k - 1] = node(i, j, k, ')');
        }
      }
    }
  }
  long long curi = n, curj = m, cur_balance = 0;
  for (long long i = 0; i < 410; ++i) {
    if (dp[n][m][cur_balance] + cur_balance > dp[n][m][i] + i &&
        dp[n][m][i] != inf) {
      cur_balance = i;
    }
  }
  string ans = "";
  long long temp = cur_balance;
  while (curi > 0 || curj > 0 || cur_balance) {
    node a = p[curi][curj][cur_balance];
    long long ni = a.i;
    long long nj = a.j;
    long long nbal = a.bal;
    ans += a.scoba;
    curi = a.i;
    curj = a.j;
    cur_balance = a.bal;
  }
  while (temp--) ans = ')' + ans;
  reverse(ans.begin(), ans.end());
  cout << ans;
  return 0;
}
