#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 210;
const int inf = 1.01e9;
int dp[2 * N][N][N];
string res = "";
string foo, bar;
int n, m;
int rec(int p, int i, int j) {
  if (p < 0 || p >= 2 * N) return inf;
  if (i == n && j == m) return p;
  if (dp[p][i][j] != -1) return dp[p][i][j];
  return dp[p][i][j] =
             1 + min(rec(p + 1, i + (foo[i] == '('), j + (bar[j] == '(')),
                     rec(p - 1, i + (foo[i] == ')'), j + (bar[j] == ')')));
}
void trace(int p, int i, int j) {
  if (p < 0 || p >= 2 * N) assert(false);
  if (i == n && j == m) {
    res += string(p, ')');
    return;
  }
  if (rec(p, i, j) ==
      1 + rec(p + 1, i + (foo[i] == '('), j + (bar[j] == '('))) {
    res += "(";
    trace(p + 1, i + (foo[i] == '('), j + (bar[j] == '('));
  } else {
    res += ")";
    trace(p - 1, i + (foo[i] == ')'), j + (bar[j] == ')'));
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  memset(dp, -1, sizeof dp);
  cin >> foo >> bar;
  n = (int)foo.size();
  m = (int)bar.size();
  if (n > m) swap(n, m), swap(foo, bar);
  foo += '+';
  bar += '+';
  res = "";
  trace(0, 0, 0);
  cout << res << '\n';
  return 0;
}
