#include <bits/stdc++.h>
using namespace std;
int dp[201][201][201];
string s, t;
string Res = "";
int solve(int i, int j, int op) {
  if (i == s.size() && j == t.size()) return op;
  if (dp[i][j][op] != -1) return dp[i][j][op];
  int x1 = 1e9, x2 = 1e9;
  if (op == 0)
    x1 = solve(i + (i + 1 <= s.size() && s[i] == '('),
               j + (j + 1 <= t.size() && t[j] == '('), op + 1) +
         1;
  else if (i == s.size()) {
    if (t[j] == '(')
      x1 = solve(i, j + 1, op + 1) + 1;
    else
      x1 = solve(i, j + 1, op - 1) + 1;
  } else if (j == t.size()) {
    if (s[i] == '(')
      x1 = solve(i + 1, j, op + 1) + 1;
    else
      x1 = solve(i + 1, j, op - 1) + 1;
  } else {
    if (s[i] == '(' && t[j] == '(')
      x1 = solve(i + 1, j + 1, op + 1) + 1;
    else if (s[i] == ')' && t[j] == ')')
      x1 = solve(i + 1, j + 1, op - 1) + 1;
    else {
      x1 = solve(i + (s[i] == '('), j + (t[j] == '('), op + 1) + 1;
      x2 = solve(i + (s[i] == ')'), j + (t[j] == ')'), op - 1) + 1;
    }
  }
  return dp[i][j][op] = min(x1, x2);
}
void get_path(int i, int j, int op) {
  if (i == s.size() && j == t.size()) return;
  int optimal = dp[i][j][op];
  int x1 = 1e9, x2 = 1e9;
  if (op == 0) {
    get_path(i + (i + 1 <= s.size() && s[i] == '('),
             j + (j + 1 <= t.size() && t[j] == '('), op + 1);
    Res += '(';
  } else if (i == s.size()) {
    if (t[j] == '(') {
      get_path(i, j + 1, op + 1);
      Res += '(';
    } else {
      get_path(i, j + 1, op - 1);
      Res += ')';
    }
  } else if (j == t.size()) {
    if (s[i] == '(') {
      get_path(i + 1, j, op + 1);
      Res += '(';
    } else {
      get_path(i + 1, j, op - 1);
      Res += ')';
    }
  } else {
    if (s[i] == '(' && t[j] == '(') {
      get_path(i + 1, j + 1, op + 1);
      Res += '(';
    } else if (s[i] == ')' && t[j] == ')') {
      get_path(i + 1, j + 1, op - 1);
      Res += ')';
    } else {
      x1 = solve(i + (s[i] == '('), j + (t[j] == '('), op + 1) + 1;
      x2 = solve(i + (s[i] == ')'), j + (t[j] == ')'), op - 1) + 1;
      if (optimal == x1) {
        get_path(i + (s[i] == '('), j + (t[j] == '('), op + 1);
        Res += '(';
      } else {
        get_path(i + (s[i] == ')'), j + (t[j] == ')'), op - 1);
        Res += ')';
      }
    }
  }
}
int main() {
  cin >> s >> t;
  memset(dp, -1, sizeof dp);
  solve(0, 0, 0);
  get_path(0, 0, 0);
  reverse(Res.begin(), Res.end());
  int op = 0, cl = 0;
  for (int i = 0; i < Res.size(); i++) {
    if (Res[i] == '(')
      op++;
    else
      cl++;
  }
  for (int i = 0; i < op - cl; i++) Res += ')';
  cout << Res;
  return 0;
}
