#include <bits/stdc++.h>
using namespace std;
template <typename T>
istream& operator>>(istream& is, vector<T>& a) {
  for (T& ai : a) is >> ai;
  return is;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> const& a) {
  os << "[ ";
  for (const T& ai : a) os << ai << " ";
  return os << "]";
}
template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& a) {
  return is >> a.first >> a.second;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2> const& a) {
  return os << "(" << a.first << ", " << a.second << ")";
}
string f() {
  string s, t;
  cin >> s >> t;
  int n = s.size(), m = t.size();
  int l = max(n, m);
  vector<int> prev((n + 1) * (m + 1) * (l + 1), -1);
  queue<int> q;
  q.push(0);
  int d = ((n + 1) * (m + 1) - 1) * (l + 1);
  while (!q.empty() && prev[d] < 0) {
    int u = q.front();
    q.pop();
    int i = u;
    int k = i % (l + 1);
    i /= l + 1;
    int j = i % (m + 1);
    i /= m + 1;
    if (k < l) {
      int v = u + 1;
      if (i < n && s[i] == '(') v += (l + 1) * (m + 1);
      if (j < m && t[j] == '(') v += l + 1;
      if (prev[v] < 0) {
        prev[v] = u;
        q.push(v);
      }
    }
    if (k > 0) {
      int v = u - 1;
      if (i < n && s[i] == ')') v += (l + 1) * (m + 1);
      if (j < m && t[j] == ')') v += l + 1;
      if (prev[v] < 0) {
        prev[v] = u;
        q.push(v);
      }
    }
  }
  string r;
  int u = d;
  while (prev[u] >= 0) {
    r.push_back((u % (l + 1) - prev[u] % (l + 1) > 0) ? '(' : ')');
    u = prev[u];
  }
  reverse((r).begin(), (r).end());
  return r;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << f() << "\n";
  return 0;
}
