#include <bits/stdc++.h>
using namespace std;
const int maxN = 2e2 + 7;
string A, B, C = "()";
int a, b, c[] = {1, -1};
int dp[maxN][maxN][maxN];
int get(int i, int j, int k) {
  if (k > 200 || k < 0) return 1e9;
  if (i == a && j == b && !k) return 0;
  int &ans = dp[i][j][k];
  if (ans + 1) return ans;
  ans = 1e9;
  for (int x = 0; x < 2; x++) {
    ans = min(ans, get(i + (C[x] == A[i]), j + (C[x] == B[j]), k + c[x]) + 1);
  }
  return ans;
}
void trace(int i, int j, int k) {
  if (!k && i == a && j == b) return;
  int res = get(i, j, k);
  for (int x = 0; x < 2; x++) {
    if (res == get(i + (C[x] == A[i]), j + (C[x] == B[j]), k + c[x]) + 1) {
      cout << C[x];
      trace(i + (C[x] == A[i]), j + (C[x] == B[j]), k + c[x]);
      break;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  if (fopen("test.inp", "r")) freopen("test.inp", "r", stdin);
  memset(dp, -1, sizeof dp);
  cin >> A >> B;
  a = A.size(), b = B.size();
  A = A + '#', B = B + '#';
  trace(0, 0, 0);
}
