#include <bits/stdc++.h>
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")
using namespace std;
template <class T, class U>
inline void checkmin(T &x, U y) {
  if (y < x) x = y;
}
template <class T, class U>
inline void checkmax(T &x, U y) {
  if (y > x) x = y;
}
template <class T, class U>
inline bool ifmax(T &x, U y) {
  if (y > x) return x = y, true;
  return false;
}
template <class T, class U>
inline bool ifmin(T &x, U y) {
  if (y < x) return x = y, true;
  return false;
}
template <class T>
inline void sort(T &a) {
  sort(a.begin(), a.end());
}
template <class T>
inline void rsort(T &a) {
  sort(a.rbegin(), a.rend());
}
template <class T>
inline void reverse(T &a) {
  reverse(a.begin(), a.end());
}
template <class T, class U>
inline istream &operator>>(istream &str, pair<T, U> &p) {
  return str >> p.first >> p.second;
}
template <class T>
inline istream &operator>>(istream &str, vector<T> &a) {
  for (auto &i : a) str >> i;
  return str;
}
template <class T>
inline T sorted(T a) {
  sort(a);
  return a;
}
const int N = 205;
int dp[N][N][N];
struct pos {
  int p1 = -1, p2 = -1, balance;
  pos() {}
  pos(int p1, int p2, int balance) {
    this->p1 = p1;
    this->p2 = p2;
    this->balance = balance;
  }
};
pos p[N][N][N];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(12);
  srand(94385);
  string second, t;
  cin >> second >> t;
  second = '0' + second;
  t = '0' + t;
  for (int i = 0; i < N; ++i)
    for (int j = 0; j < N; ++j)
      for (int k = 0; k < N; ++k) dp[i][j][k] = 1000000007;
  for (int balance = 0; balance < N; ++balance) dp[0][0][balance] = balance;
  for (int p1 = 0; p1 < signed(second.size()); ++p1)
    for (int p2 = 0; p2 < signed(t.size()); ++p2)
      if (p1 > 0 || p2 > 0) {
        for (int balance = 0; balance < N; ++balance) {
          pos &past = p[p1][p2][balance];
          if (balance > 0) {
            if (second[p1] == '(') {
              if (ifmin(dp[p1][p2][balance], dp[p1 - 1][p2][balance - 1] + 1))
                past = {p1 - 1, p2, balance - 1};
            }
            if (t[p2] == '(') {
              if (ifmin(dp[p1][p2][balance], dp[p1][p2 - 1][balance - 1] + 1))
                past = {p1, p2 - 1, balance - 1};
            }
            if (second[p1] == '(' && t[p2] == '(') {
              if (ifmin(dp[p1][p2][balance],
                        dp[p1 - 1][p2 - 1][balance - 1] + 1))
                past = {p1 - 1, p2 - 1, balance - 1};
            }
          }
          if (second[p1] == ')') {
            if (ifmin(dp[p1][p2][balance], dp[p1 - 1][p2][balance + 1] + 1))
              past = {p1 - 1, p2, balance + 1};
          }
          if (t[p2] == ')') {
            if (ifmin(dp[p1][p2][balance], dp[p1][p2 - 1][balance + 1] + 1))
              past = {p1, p2 - 1, balance + 1};
          }
          if (second[p1] == ')' && t[p2] == ')') {
            if (ifmin(dp[p1][p2][balance], dp[p1 - 1][p2 - 1][balance + 1] + 1))
              past = {p1 - 1, p2 - 1, balance + 1};
          }
        }
      }
  pair<int, pos> ans;
  ans.first = 1000000007;
  for (int balance = 0; balance < N; ++balance)
    if (ifmin(ans.first,
              dp[signed(second.size()) - 1][signed(t.size()) - 1][balance] +
                  balance))
      ans.second =
          pos(signed(second.size()) - 1, signed(t.size()) - 1, balance);
  pos curr = ans.second;
  string answer(curr.balance, ')');
  pos check = p[1][2][0];
  while (curr.p1 > 0 || curr.p2 > 0) {
    if (curr.balance > p[curr.p1][curr.p2][curr.balance].balance)
      answer = '(' + answer;
    else
      answer = ')' + answer;
    curr = p[curr.p1][curr.p2][curr.balance];
  }
  while (curr.balance) answer = '(' + answer, --curr.balance;
  cout << answer;
  return 0;
}
