#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const int N = 210;
const int inf = 1e9 + 7;
int dp[N][N][N];
vector<int> pr[N][N][N];
string t = "";
void rec(int i, int j, int b) {
  if (i == 0 && j == 0 && b == 0) return;
  if (pr[i][j][b][2] > b)
    t += ')';
  else
    t += '(';
  rec(pr[i][j][b][0], pr[i][j][b][1], pr[i][j][b][2]);
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  string s1;
  cin >> s1;
  int n = s.size();
  int m = s1.size();
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++)
      for (int b = 0; b < N; b++) dp[i][j][b] = inf;
  dp[0][0][0] = 0;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++)
      for (int b = 0; b <= max(n, m); b++) {
        int ni = i + (s[i] == '(');
        int nj = j + (s1[j] == '(');
        if (dp[ni][nj][b + 1] > dp[i][j][b] + 1) {
          dp[ni][nj][b + 1] = min(dp[ni][nj][b + 1], dp[i][j][b] + 1);
          pr[ni][nj][b + 1] = {i, j, b};
        }
        if (b) {
          ni = i + (s[i] == ')');
          nj = j + (s1[j] == ')');
          if (dp[ni][nj][b - 1] > dp[i][j][b] + 1) {
            dp[ni][nj][b - 1] = min(dp[ni][nj][b - 1], dp[i][j][b] + 1);
            pr[ni][nj][b - 1] = {i, j, b};
          }
        }
      }
  int ans = 0;
  for (int b = 0; b < N; b++)
    if (dp[n][m][ans] + ans > dp[n][m][b] + b) ans = b;
  rec(n, m, ans);
  reverse(t.begin(), t.end());
  while (ans--) t += ')';
  cout << t;
  return 0;
}
