#include <bits/stdc++.h>
using namespace std;
int dp[205][205][205], p[205][205][205];
int main() {
  char sa[205], sb[205], ans[410];
  int a, b, i, j, k, x, y, z, len = 1000, c, f;
  scanf("%s %s", sa, sb);
  a = strlen(sa);
  b = strlen(sb);
  memset(dp, 0x7f, sizeof(dp));
  for (i = 0; i <= a; i++) {
    for (j = 0; j <= b; j++) {
      for (k = 0; k <= 201; k++) {
        if (i == 0 && j == 0) {
          dp[i][j][k] = k;
          p[i][j][k] = 0;
        } else if (i == 0) {
          if (sb[j - 1] == '(') {
            if (k == 0) {
              dp[i][j][k] = dp[i][j - 1][k] + 2;
              p[i][j][k] = 32;
            } else {
              dp[i][j][k] = dp[i][j - 1][k - 1] + 1;
              p[i][j][k] = 33;
            }
          } else {
            if (k == 201) {
              dp[i][j][k] = dp[i][j - 1][k] + 2;
              p[i][j][k] = 32;
            } else {
              dp[i][j][k] = dp[i][j - 1][k + 1] + 1;
              p[i][j][k] = 31;
            }
          }
        } else if (j == 0) {
          if (sa[i - 1] == '(') {
            if (k == 0) {
              dp[i][j][k] = dp[i - 1][j][k] + 2;
              p[i][j][k] = 12;
            } else {
              dp[i][j][k] = dp[i - 1][j][k - 1] + 1;
              p[i][j][k] = 13;
            }
          } else {
            if (k == 201) {
              dp[i][j][k] = dp[i - 1][j][k] + 2;
              p[i][j][k] = 12;
            } else {
              dp[i][j][k] = dp[i - 1][j][k + 1] + 1;
              p[i][j][k] = 11;
            }
          }
        } else {
          if (sa[i - 1] == sb[j - 1]) {
            if (sa[i - 1] == '(') {
              if (k == 0) {
                if (dp[i][j][k] > dp[i - 1][j - 1][k] + 2) {
                  dp[i][j][k] = dp[i - 1][j - 1][k] + 2;
                  p[i][j][k] = 22;
                }
              } else {
                if (dp[i][j][k] > dp[i - 1][j - 1][k - 1] + 1) {
                  dp[i][j][k] = dp[i - 1][j - 1][k - 1] + 1;
                  p[i][j][k] = 23;
                }
              }
            } else {
              if (k == 201) {
                if (dp[i][j][k] > dp[i - 1][j - 1][k] + 2) {
                  dp[i][j][k] = dp[i - 1][j - 1][k] + 2;
                  p[i][j][k] = 22;
                }
              } else {
                if (dp[i][j][k] > dp[i - 1][j - 1][k + 1] + 1) {
                  dp[i][j][k] = dp[i - 1][j - 1][k + 1] + 1;
                  p[i][j][k] = 21;
                }
              }
            }
          }
          if (sa[i - 1] == '(') {
            if (k == 0) {
              if (dp[i][j][k] > dp[i - 1][j][k] + 2) {
                dp[i][j][k] = dp[i - 1][j][k] + 2;
                p[i][j][k] = 12;
              }
            } else {
              if (dp[i][j][k] > dp[i - 1][j][k - 1] + 1) {
                dp[i][j][k] = dp[i - 1][j][k - 1] + 1;
                p[i][j][k] = 13;
              }
            }
          } else {
            if (k == 201) {
              if (dp[i][j][k] > dp[i - 1][j][k] + 2) {
                dp[i][j][k] = dp[i - 1][j][k] + 2;
                p[i][j][k] = 12;
              }
            } else {
              if (dp[i][j][k] > dp[i - 1][j][k + 1] + 1) {
                dp[i][j][k] = dp[i - 1][j][k + 1] + 1;
                p[i][j][k] = 11;
              }
            }
          }
          if (sb[j - 1] == '(') {
            if (k == 0) {
              if (dp[i][j][k] > dp[i][j - 1][k] + 2) {
                dp[i][j][k] = dp[i][j - 1][k] + 2;
                p[i][j][k] = 32;
              }
            } else {
              if (dp[i][j][k] > dp[i][j - 1][k - 1] + 1) {
                dp[i][j][k] = dp[i][j - 1][k - 1] + 1;
                p[i][j][k] = 33;
              }
            }
          } else {
            if (k == 201) {
              if (dp[i][j][k] > dp[i][j - 1][k] + 2) {
                dp[i][j][k] = dp[i][j - 1][k] + 2;
                p[i][j][k] = 32;
              }
            } else {
              if (dp[i][j][k] > dp[i][j - 1][k + 1] + 1) {
                dp[i][j][k] = dp[i][j - 1][k + 1] + 1;
                p[i][j][k] = 31;
              }
            }
          }
        }
        if (i == a && j == b) {
          if (len > dp[i][j][k] + k) {
            len = dp[i][j][k] + k;
            z = k;
          }
        }
      }
    }
  }
  x = a;
  y = b;
  c = 0;
  for (i = 0; i < z; i++) {
    ans[len - c - 1] = ')';
    c++;
  }
  while (c < len) {
    f = z;
    if (x == 0 && y == 0) {
      ans[len - c - 1] = '(';
      c++;
      continue;
    }
    if (p[x][y][z] % 10 == 1) {
      ans[len - c - 1] = ')';
      z += 1;
      c++;
    } else if (p[x][y][z] % 10 == 3) {
      ans[len - c - 1] = '(';
      z -= 1;
      c++;
    } else {
      ans[len - c - 1] = ')';
      c++;
      ans[len - c - 1] = '(';
      c++;
    }
    if (p[x][y][f] / 10 == 1) {
      x -= 1;
    } else if (p[x][y][f] / 10 == 3) {
      y -= 1;
    } else {
      x -= 1;
      y -= 1;
    }
  }
  for (i = 0; i < len; i++) printf("%c", ans[i]);
  printf("\n");
  return 0;
}
