#include <bits/stdc++.h>
using namespace std;
const int MAX = 205;
const int INF = 0x3f3f3f3f;
string a, b;
int dp[MAX][MAX][405];
int call(int x, int y, int s) {
  if (x >= a.size() and y >= b.size()) return s;
  if (dp[x][y][s] != -1) return dp[x][y][s];
  int ret = INF;
  if (x < a.size() and y < b.size() and a[x] == b[y]) {
    if (a[x] == '(') {
      ret = min(ret, 1 + call(x + 1, y + 1, s + 1));
    } else {
      if (s) {
        ret = min(ret, 1 + call(x + 1, y + 1, s - 1));
      } else {
        ret = min(ret, 2 + call(x + 1, y + 1, s));
      }
    }
  } else {
    if (x < a.size()) {
      if (a[x] == '(') {
        ret = min(ret, 1 + call(x + 1, y, s + 1));
      } else {
        if (s) {
          ret = min(ret, 1 + call(x + 1, y, s - 1));
        } else {
          ret = min(ret, 2 + call(x + 1, y, s));
        }
      }
    }
    if (y < b.size()) {
      if (b[y] == '(') {
        ret = min(ret, 1 + call(x, y + 1, s + 1));
      } else {
        if (s) {
          ret = min(ret, 1 + call(x, y + 1, s - 1));
        } else {
          ret = min(ret, 2 + call(x, y + 1, s));
        }
      }
    }
  }
  return dp[x][y][s] = ret;
}
void go(int x, int y, int s) {
  if (x >= a.size() and y >= b.size()) {
    for (int i = 0; i < s; i++) cout << ')';
    cout << endl;
    return;
  }
  int ret = call(x, y, s);
  if (x < a.size() and y < b.size() and a[x] == b[y]) {
    if (a[x] == '(') {
      if (ret == 1 + call(x + 1, y + 1, s + 1)) {
        cout << '(';
        go(x + 1, y + 1, s + 1);
        return;
      }
    } else {
      if (s) {
        if (ret == 1 + call(x + 1, y + 1, s - 1)) {
          cout << ')';
          go(x + 1, y + 1, s - 1);
          return;
        }
      } else {
        if (ret == 2 + call(x + 1, y + 1, s)) {
          cout << "()";
          go(x + 1, y + 1, s);
          return;
        }
      }
    }
  } else {
    if (x < a.size()) {
      if (a[x] == '(') {
        if (ret == 1 + call(x + 1, y, s + 1)) {
          cout << '(';
          go(x + 1, y, s + 1);
          return;
        }
      } else {
        if (s) {
          if (ret == 1 + call(x + 1, y, s - 1)) {
            cout << ')';
            go(x + 1, y, s - 1);
            return;
          }
        } else {
          if (ret == 2 + call(x + 1, y, s)) {
            cout << "()";
            go(x + 1, y, s);
            return;
          }
        }
      }
    }
    if (y < b.size()) {
      if (b[y] == '(') {
        if (ret == 1 + call(x, y + 1, s + 1)) {
          cout << '(';
          go(x, y + 1, s + 1);
          return;
        }
      } else {
        if (s) {
          if (ret == 1 + call(x, y + 1, s - 1)) {
            cout << ')';
            go(x, y + 1, s - 1);
            return;
          }
        } else {
          if (ret == 2 + call(x, y + 1, s)) {
            cout << "()";
            go(x, y + 1, s);
            return;
          }
        }
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> a >> b;
  memset(dp, -1, sizeof(dp));
  go(0, 0, 0);
  return 0;
}
