#include <bits/stdc++.h>
using namespace std;
int dp[205][205][205];
int from[205][205][205];
string S, T;
string ans;
void get(int i, int j, int b) {
  if (i == 0 && j == 0 && b == 0) return;
  int fi = from[i][j][b] / (205 * 205);
  int fj = from[i][j][b] % (205 * 205) / 205;
  int fb = from[i][j][b] % 205;
  get(fi, fj, fb);
  if (fb < b)
    ans.push_back('(');
  else
    ans.push_back(')');
}
int main() {
  cin >> S >> T;
  memset(dp, 0x3f, sizeof(dp));
  dp[0][0][0] = 0;
  for (int i = 0; i <= S.size(); i++) {
    for (int j = 0; j <= T.size(); j++) {
      for (int b = 0; b < 205; b++) {
        if (dp[i][j][b] + 1 < dp[i][j][b + 1])
          dp[i][j][b + 1] = dp[i][j][b] + 1,
                       from[i][j][b + 1] = (i * 205 * 205 + j * 205 + b);
        for (char c : "()") {
          int diff = (c == '(') ? 1 : -1;
          if (b + diff < 205 && b + diff >= 0 && i + (S[i] == c) <= S.size() &&
              j + (T[j] == c) <= T.size()) {
            if (dp[i][j][b] + 1 <
                dp[i + (S[i] == c)][j + (T[j] == c)][b + diff])
              dp[i + (S[i] == c)][j + (T[j] == c)]
                [b + diff] = dp[i][j][b] + 1,
                     from[i + (S[i] == c)][j + (T[j] == c)][b + diff] =
                         (i * 205 * 205 + j * 205 + b);
          }
        }
      }
    }
  }
  int mini = 0;
  for (int i = 1; i < 205; i++)
    if (dp[S.size()][T.size()][i] + i < dp[S.size()][T.size()][mini] + mini)
      mini = i;
  get(S.size(), T.size(), mini);
  for (int i = 0; i < mini; i++) ans.push_back(')');
  cout << ans << endl;
  return 0;
}
