#include <bits/stdc++.h>
int inp() {
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  int sum = 0;
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  return sum;
}
int f[210][210][410];
char s[210], t[210];
int fi[210][210][410], fj[210][210][410], fu[210][210][410];
char br[3] = {'(', ' ', ')'}, ans[10010];
void ckmin(int i, int j, int u, int b, int _i, int _j, int _u) {
  f[i][j][u] = std::min(f[i][j][u], b);
  if (f[i][j][u] == b) {
    fi[i][j][u] = _i;
    fj[i][j][u] = _j;
    fu[i][j][u] = _u;
  }
}
int main() {
  scanf("%s", s + 1);
  scanf("%s", t + 1);
  int n = strlen(s + 1);
  int m = strlen(t + 1);
  memset(f, 0x3f, sizeof(f));
  f[0][0][0] = 0;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++) {
      for (int u = 0; u <= 400; u++)
        ckmin(i + (s[i + 1] == '('), j + (t[j + 1] == '('), u + 1,
              f[i][j][u] + 1, i, j, u);
      for (int u = 400; u > 0; u--)
        ckmin(i + (s[i + 1] == ')'), j + (t[j + 1] == ')'), u - 1,
              f[i][j][u] + 1, i, j, u);
    }
  int i = n;
  int j = m;
  int u = 0;
  while (i != 0 || j != 0 || u != 0) {
    ans[f[i][j][u]] = br[fu[i][j][u] - u + 1];
    int _i = fi[i][j][u];
    int _j = fj[i][j][u];
    int _u = fu[i][j][u];
    i = _i;
    j = _j;
    u = _u;
  }
  for (int i = 1; i <= f[n][m][0]; i++) putchar(ans[i]);
  putchar('\n');
}
