#include <bits/stdc++.h>
using namespace std;
const long long int logx = 30;
const long long int N = 1e5 + 5;
const long long int M = 3e5 + 5;
const long long int mod = 1e9 + 7;
const long long int INF = 1e18 + 5;
const double PI = 3.14159265358979323846;
inline long long int mul(long long int a, long long int b) {
  return (a * 1ll * b) % mod;
}
inline long long int sub(long long int a, long long int b) {
  long long int c = a - b;
  if (c < 0) c += mod;
  return c;
}
inline long long int add(long long int a, long long int b) {
  long long int c = a + b;
  if (c > mod) c -= mod;
  return c;
}
template <typename T>
T power(T x, T y, long long int m) {
  T ans = 1;
  while (y > 0) {
    if (y & 1LL) ans = (ans * x) % m;
    y >>= 1ll;
    x = (x * x) % m;
  }
  return ans % m;
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
long long int n, m;
string second, t;
long long int dp[205][205][410];
long long int F(long long int i, long long int j, long long int open) {
  long long int res = INF;
  if (open < 0) {
    return INF;
  }
  if (open >= 410) {
    return INF;
  }
  if (open == 0) {
    if (i == n && j == m) {
      return 0;
    }
  }
  if (dp[i][j][open] != -1) {
    return dp[i][j][open];
  }
  if (i == n && j == m) {
    return open;
  }
  if (i == n && j != m) {
    res = min(res, 1 + F(i, j + (t[j] == '('), open + 1));
    res = min(res, 1 + F(i, j + (t[j] == ')'), open - 1));
  }
  if (i != n && j == m) {
    res = min(res, 1 + F(i + (second[i] == '('), j, open + 1));
    res = min(res, 1 + F(i + (second[i] == ')'), j, open - 1));
  }
  if (i != n && j != m) {
    res = min(res, 1 + F(i + (second[i] == '('), j + (t[j] == '('), open + 1));
    res = min(res, 1 + F(i + (second[i] == ')'), j + (t[j] == ')'), open - 1));
  }
  return dp[i][j][open] = res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  memset(dp, -1, sizeof(dp));
  cin >> second >> t;
  n = second.length();
  m = t.length();
  string out = "\0";
  long long int ans = F(0, 0, 0), prevans = 0, prei = 0, prej = 0, preopen = 0;
  for (long long int i = 0; i < ans; i++) {
    long long int tempans =
        1 + prevans +
        F(prei + (second[prei] == '('), prej + (t[prej] == '('), preopen + 1);
    if (tempans == ans) {
      out += "(";
      prevans++;
      preopen++;
      prei += (second[prei] == '(');
      prej += (t[prej] == '(');
      continue;
    }
    tempans =
        1 + prevans +
        F(prei + (second[prei] == ')'), prej + (t[prej] == ')'), preopen - 1);
    if (tempans == ans) {
      out += ")";
      prevans++;
      preopen--;
      prei += (second[prei] == ')');
      prej += (t[prej] == ')');
      continue;
    }
  }
  cout << out << endl;
}
