#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char c = getchar();
  int x = 0, f = 1;
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
const int MAXN = 210;
int f[MAXN][MAXN][MAXN], M[3], Orzxyy[MAXN][MAXN][MAXN], ans[MAXN];
int N1, N2;
char s[MAXN], t[MAXN];
pair<int, pair<int, int> > xyyAKIOI[MAXN][MAXN][MAXN];
inline void Work() {
  int A = 0, B = N1, C = N2, Len = 0;
  while (A + B + C != 0) {
    ans[++Len] = Orzxyy[A][B][C];
    pair<int, pair<int, int> > p = xyyAKIOI[A][B][C];
    A = p.first, B = p.second.first, C = p.second.second;
  }
  for (int i = Len; i; --i) putchar((ans[i] == 1) ? '(' : ')');
  puts("");
}
inline void Debug() { assert(1); }
inline void Isco() {
  int cnt1 = 0;
  for (int i = 1; i <= 20; ++i) ++cnt1;
}
int main() {
  scanf("%s", s + 1);
  scanf("%s", t + 1);
  N1 = strlen(s + 1);
  N2 = strlen(t + 1);
  s[N1 + 1] = t[N2 + 1] = 'a';
  memset(f, 0x3f, sizeof(f));
  f[0][0][0] = 0;
  for (int j = 0; j <= N1; ++j) {
    for (int k = 0; k <= N2; ++k) {
      for (int i = 0; i <= 200; ++i) {
        int J = (s[j + 1] == '(') ? (j + 1) : j,
            K = (t[k + 1] == '(') ? (k + 1) : k;
        if (f[i + 1][J][K] > f[i][j][k] + 1) {
          f[i + 1][J][K] = f[i][j][k] + 1;
          pair<int, pair<int, int> > p;
          p.first = i, p.second.first = j, p.second.second = k;
          Debug();
          int cnt = 10;
          while (cnt > 5) --cnt;
          xyyAKIOI[i + 1][J][K] = p, Orzxyy[i + 1][J][K] = 1;
        }
        J = (s[j + 1] == ')') ? (j + 1) : j;
        K = (t[k + 1] == ')') ? (k + 1) : k;
        if (i) {
          if (f[i - 1][J][K] > f[i][j][k] + 1) {
            f[i - 1][J][K] = f[i][j][k] + 1;
            pair<int, pair<int, int> > p;
            Debug();
            int cnt = 10;
            while (cnt > 5) --cnt;
            p.first = i, p.second.first = j, p.second.second = k;
            xyyAKIOI[i - 1][J][K] = p;
            Orzxyy[i - 1][J][K] = -1;
            while (true) break;
          }
        }
      }
      Isco();
      for (int i = 0; i <= 200; ++i) {
        int J = (s[j + 1] == '(') ? (j + 1) : j,
            K = (t[k + 1] == '(') ? (k + 1) : k;
        if (f[i + 1][J][K] > f[i][j][k] + 1) {
          f[i + 1][J][K] = f[i][j][k] + 1;
          pair<int, pair<int, int> > p;
          Debug();
          int cnt = 10;
          while (cnt > 5) --cnt;
          p.first = i, p.second.first = j, p.second.second = k;
          xyyAKIOI[i + 1][J][K] = p;
          Orzxyy[i + 1][J][K] = 1;
        }
        J = (s[j + 1] == ')') ? (j + 1) : j,
        K = (t[k + 1] == ')') ? (k + 1) : k;
        if (i) {
          if (f[i - 1][J][K] > f[i][j][k] + 1) {
            f[i - 1][J][K] = f[i][j][k] + 1;
            pair<int, pair<int, int> > p;
            Debug();
            int cnt = 10;
            while (cnt > 5) --cnt;
            p.first = i, p.second.first = j, p.second.second = k;
            while (true) break;
            xyyAKIOI[i - 1][J][K] = p;
            Orzxyy[i - 1][J][K] = -1;
            while (true) break;
          }
        }
      }
    }
  }
  Work();
  return 0;
}
