#include <bits/stdc++.h>
using namespace std;
const int N = 205;
int dp[N][N][N << 1];
pair<pair<int, int>, int> p[N][N][N << 1];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  int n = int((s).size()), m = int((t).size());
  for (int i = int(0); i < int(n + 1); ++i)
    for (int j = int(0); j < int(m + 1); ++j)
      for (int k = int(0); k < int(N << 1); ++k) dp[i][j][k] = 1e9;
  dp[0][0][0] = 0;
  queue<pair<pair<int, int>, int> > Q;
  Q.push(make_pair(make_pair(0, 0), 0));
  for (; !Q.empty(); Q.pop()) {
    int x = Q.front().first.first, y = Q.front().first.second,
        d = Q.front().second;
    if (x == n && y == m && !d) break;
    if (d + 1 < (N << 1)) {
      int nxtX = x + (x < n && s[x] == '(');
      int nxtY = y + (y < m && t[y] == '(');
      if (dp[x][y][d] + 1 < dp[nxtX][nxtY][d + 1]) {
        dp[nxtX][nxtY][d + 1] = dp[x][y][d] + 1;
        p[nxtX][nxtY][d + 1] = make_pair(make_pair(x, y), d);
        Q.push(make_pair(make_pair(nxtX, nxtY), d + 1));
      }
    }
    if (d) {
      int nxtX = x + (x < n && s[x] == ')');
      int nxtY = y + (y < m && t[y] == ')');
      if (dp[x][y][d] + 1 < dp[nxtX][nxtY][d - 1]) {
        dp[nxtX][nxtY][d - 1] = dp[x][y][d] + 1;
        p[nxtX][nxtY][d - 1] = make_pair(make_pair(x, y), d);
        Q.push(make_pair(make_pair(nxtX, nxtY), d - 1));
      }
    }
  }
  int i = n, j = m, k = 0;
  string ans = "";
  while (i || j || k) {
    int nxtI = p[i][j][k].first.first;
    int nxtJ = p[i][j][k].first.second;
    int nxtK = p[i][j][k].second;
    if (nxtK < k)
      ans.push_back('(');
    else
      ans.push_back(')');
    i = nxtI, j = nxtJ, k = nxtK;
  }
  reverse((ans).begin(), (ans).end());
  cout << ans << endl;
  return 0;
}
