#include <bits/stdc++.h>
using namespace std;
inline int add(int a, int b) {
  a += b;
  return a >= 1000000007 ? a - 1000000007 : a;
}
inline int sub(int a, int b) {
  a -= b;
  return a < 0 ? a + 1000000007 : a;
}
inline int mul(int a, int b) { return (long long int)a * b % 1000000007; }
int Set(int N, int pos) { return N = N | (1 << pos); }
int Reset(int N, int pos) { return N = N & ~(1 << pos); }
bool Cheek(int N, int pos) { return (bool)(N & (1 << pos)); }
string s1, s2, ans = "";
int len1, len2, dp[205][205][205];
int FuN(int pos1, int pos2, int open) {
  if (pos1 >= len1 && pos2 >= len2) return dp[pos1][pos2][open] = open;
  if (dp[pos1][pos2][open] != -1) return dp[pos1][pos2][open];
  int ret1 = (1 << 28), ret2 = (1 << 28);
  if (pos1 < len1 && pos2 < len2 && s1[pos1] == s2[pos2]) {
    if (s1[pos1] == '(')
      ret1 = 1 + FuN(pos1 + 1, pos2 + 1, open + 1);
    else {
      if (open > 0)
        ret2 = 1 + FuN(pos1 + 1, pos2 + 1, open - 1);
      else
        ret2 = 2 + FuN(pos1 + 1, pos2 + 1, open);
    }
  } else {
    if ((pos1 < len1 && s1[pos1] == '(') || (pos2 < len2 && s2[pos2] == '('))
      ret1 = 1 + FuN(pos1 + (pos1 < len1 && s1[pos1] == '('),
                     pos2 + (pos2 < len2 && s2[pos2] == '('), open + 1);
    if ((pos1 < len1 && s1[pos1] == ')') || (pos2 < len2 && s2[pos2] == ')')) {
      if (open > 0)
        ret2 = 1 + FuN(pos1 + (pos1 < len1 && s1[pos1] == ')'),
                       pos2 + (pos2 < len2 && s2[pos2] == ')'), open - 1);
      else
        ret2 = 2 + FuN(pos1 + (pos1 < len1 && s1[pos1] == ')'),
                       pos2 + (pos2 < len2 && s2[pos2] == ')'), open);
    }
  }
  return dp[pos1][pos2][open] = min(ret1, ret2);
}
void Print(int pos1, int pos2, int open) {
  if (pos1 >= len1 && pos2 >= len2) {
    for (int i = 1; i <= open; i++) printf(")");
    printf("\n");
    return;
  }
  int ret1 = (1 << 28), ret2 = (1 << 28), pr = 0;
  if (pos1 < len1 && pos2 < len2 && s1[pos1] == s2[pos2]) {
    if (s1[pos1] == '(')
      ret1 = 1 + dp[pos1 + 1][pos2 + 1][open + 1];
    else {
      if (open > 0)
        ret2 = 1 + dp[pos1 + 1][pos2 + 1][open - 1];
      else
        ret2 = 2 + dp[pos1 + 1][pos2 + 1][open], pr = 1;
    }
    if (ret1 <= ret2) {
      printf("(");
      Print(pos1 + 1, pos2 + 1, open + 1);
    } else {
      if (!pr) {
        printf(")");
        Print(pos1 + 1, pos2 + 1, open - 1);
      } else {
        printf("()");
        Print(pos1 + 1, pos2 + 1, open);
      }
    }
  } else {
    if ((pos1 < len1 && s1[pos1] == '(') || (pos2 < len2 && s2[pos2] == '('))
      ret1 = 1 + dp[pos1 + (pos1 < len1 && s1[pos1] == '(')]
                   [pos2 + (pos2 < len2 && s2[pos2] == '(')][open + 1];
    if ((pos1 < len1 && s1[pos1] == ')') || (pos2 < len2 && s2[pos2] == ')')) {
      if (open > 0)
        ret2 = 1 + dp[pos1 + (pos1 < len1 && s1[pos1] == ')')]
                     [pos2 + (pos2 < len2 && s2[pos2] == ')')][open - 1];
      else
        ret2 = 2 + dp[pos1 + (pos1 < len1 && s1[pos1] == ')')]
                     [pos2 + (pos2 < len2 && s2[pos2] == ')')][open],
        pr = 1;
    }
    if (ret1 <= ret2) {
      printf("(");
      Print(pos1 + (pos1 < len1 && s1[pos1] == '('),
            pos2 + (pos2 < len2 && s2[pos2] == '('), open + 1);
    } else {
      if (!pr) {
        printf(")");
        Print(pos1 + (pos1 < len1 && s1[pos1] == ')'),
              pos2 + (pos2 < len2 && s2[pos2] == ')'), open - 1);
      } else {
        printf("()");
        Print(pos1 + (pos1 < len1 && s1[pos1] == ')'),
              pos2 + (pos2 < len2 && s2[pos2] == ')'), open);
      }
    }
  }
}
void Solve(int t) {
  int i, j, k, ans;
  cin >> s1 >> s2;
  len1 = (int)s1.size();
  len2 = (int)s2.size();
  memset(dp, -1, sizeof(dp));
  ans = FuN(0, 0, 0);
  Print(0, 0, 0);
}
int main() {
  int t, T;
  T = 1;
  for (__typeof(t) t = 1; t <= T; t++) {
    Solve(t);
  }
  return 0;
}
