#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  int dp[s.size() + 1][t.size() + 1][201];
  for (int i = 0; i < s.size() + 1; i++)
    for (int j = 0; j < t.size() + 1; j++)
      for (int k = 0; k < 201; k++) dp[i][j][k] = 10000;
  dp[0][0][0] = 0;
  tuple<int, int, int> trace[s.size() + 1][t.size() + 1][201];
  for (int i = 0; i < s.size() + 1; i++)
    for (int j = 0; j < t.size() + 1; j++)
      for (int k = 0; k < 201; k++) {
        if (k + 1 <= 200) {
          int ni;
          if (i < s.size() && s[i] == '(')
            ni = i + 1;
          else
            ni = i;
          int nj;
          if (j < t.size() && t[j] == '(')
            nj = j + 1;
          else
            nj = j;
          if (dp[ni][nj][k + 1] > dp[i][j][k] + 1) {
            dp[ni][nj][k + 1] = dp[i][j][k] + 1;
            trace[ni][nj][k + 1] = make_tuple(i, j, k);
          }
        }
        if (k - 1 >= 0) {
          int ni;
          if (i < s.size() && s[i] == ')')
            ni = i + 1;
          else
            ni = i;
          int nj;
          if (j < t.size() && t[j] == ')')
            nj = j + 1;
          else
            nj = j;
          if (dp[ni][nj][k - 1] > dp[i][j][k] + 1) {
            dp[ni][nj][k - 1] = dp[i][j][k] + 1;
            trace[ni][nj][k - 1] = make_tuple(i, j, k);
          }
        }
      }
  string ans = "";
  int now_i = s.size();
  int now_j = t.size();
  int now_k;
  int m = 10000;
  for (int k = 0; k < 201; k++) m = min(m, dp[s.size()][t.size()][k] + k);
  for (int k = 0; k < 201; k++)
    if (dp[s.size()][t.size()][k] + k == m) now_k = k;
  for (int k = 0; k < now_k; k++) ans += ')';
  while (true) {
    int prev_i = get<0>(trace[now_i][now_j][now_k]);
    int prev_j = get<1>(trace[now_i][now_j][now_k]);
    int prev_k = get<2>(trace[now_i][now_j][now_k]);
    if (now_k - prev_k > 0)
      ans += '(';
    else
      ans += ')';
    now_i = prev_i;
    now_j = prev_j;
    now_k = prev_k;
    if (now_i == 0 && now_j == 0 && now_k == 0) break;
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}
