#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
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...);
}
int d[205][205][405], c[205][205][405], i, n, m, ans;
string a, b;
int dp(int x, int y, int z) {
  if (z < 0 || z > 400) return 1e8;
  x = min(x, n);
  y = min(y, m);
  if (x == n && y == m) return z;
  if (d[x][y][z] != -1) return d[x][y][z];
  int one = 1 + dp(x + (a[x] == '('), y + (b[y] == '('), z + 1);
  int two = 1 + dp(x + (a[x] == ')'), y + (b[y] == ')'), z - 1);
  d[x][y][z] = one;
  if (two < one) {
    d[x][y][z] = two;
    c[x][y][z] = 1;
  }
  return d[x][y][z];
}
void path(int x, int y, int z) {
  x = min(x, n);
  y = min(y, m);
  if (x == n && y == m) {
    for (i = 0; i < z; i++) cout << ')';
    return;
  }
  if (c[x][y][z]) {
    cout << ')';
    path(x + (a[x] == ')'), y + (b[y] == ')'), z - 1);
  } else {
    cout << '(';
    path(x + (a[x] == '('), y + (b[y] == '('), z + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> a >> b;
  n = a.size();
  m = b.size();
  a += "a";
  b += "b";
  memset(d, -1, sizeof(d));
  ans = dp(0, 0, 0);
  path(0, 0, 0);
  return 0;
}
