#include <bits/stdc++.h>
using namespace std;
int i, i0, n, m;
int dp[205][205][405];
int main() {
  string s, t;
  cin >> s >> t;
  for (int i = 0; i <= s.length(); i++) {
    for (int i0 = 0; i0 <= t.length(); i0++) {
      for (int p = 0; p <= 400; p++) {
        dp[i][i0][p] = 10000;
      }
    }
  }
  dp[0][0][0] = 0;
  for (int i = 0; i <= s.length(); i++) {
    for (int i0 = 0; i0 <= t.length(); i0++) {
      if (i == 0 && i0 == 0) continue;
      for (int p = 0; p <= 400; p++) {
        if (i && i0 && s[i - 1] == t[i0 - 1]) {
          if (s[i - 1] == '(') {
            if (p) {
              dp[i][i0][p] = min(dp[i][i0][p], dp[i - 1][i0 - 1][p - 1] + 1);
            }
          } else {
            dp[i][i0][p] = min(dp[i][i0][p], dp[i - 1][i0 - 1][p + 1] + 1);
            dp[i][i0][p] = min(dp[i][i0][p], dp[i - 1][i0 - 1][p] + 2);
          }
        }
        if (i && s[i - 1] == '(') {
          if (p) {
            dp[i][i0][p] = min(dp[i][i0][p], dp[i - 1][i0][p - 1] + 1);
          }
        } else if (i) {
          dp[i][i0][p] = min(dp[i][i0][p], dp[i - 1][i0][p + 1] + 1);
          dp[i][i0][p] = min(dp[i][i0][p], dp[i - 1][i0][p] + 2);
        }
        if (i0 && t[i0 - 1] == '(') {
          if (p) {
            dp[i][i0][p] = min(dp[i][i0][p], dp[i][i0 - 1][p - 1] + 1);
          }
        } else if (i0) {
          dp[i][i0][p] = min(dp[i][i0][p], dp[i][i0 - 1][p + 1] + 1);
          dp[i][i0][p] = min(dp[i][i0][p], dp[i][i0 - 1][p] + 2);
        }
      }
    }
  }
  int len = INT_MAX;
  for (int i = 0; i <= 400; i++) {
    len = min(len, i + dp[s.length()][t.length()][i]);
  }
  for (int x = 0; x <= 400; x++) {
    if (len == x + dp[s.length()][t.length()][x]) {
      string ans;
      int i = s.length(), i0 = t.length(), p = x;
      while (i != 0 || i0 != 0 || p != 0) {
        if (i && i0 && s[i - 1] == t[i0 - 1]) {
          if (s[i - 1] == '(') {
            if (p) {
              if (dp[i][i0][p] == dp[i - 1][i0 - 1][p - 1] + 1) {
                ans += s[i - 1];
                i--, i0--, p--;
                continue;
              }
            }
          } else {
            if (dp[i][i0][p] == dp[i - 1][i0 - 1][p + 1] + 1) {
              ans += s[i - 1];
              i--, i0--, p++;
              continue;
            }
            if (dp[i][i0][p] == dp[i - 1][i0 - 1][p] + 2) {
              i--, i0--;
              ans += ")(";
              continue;
            }
          }
        }
        if (i && s[i - 1] == '(') {
          if (p) {
            if (dp[i][i0][p] == dp[i - 1][i0][p - 1] + 1) {
              ans += s[i - 1];
              i--, p--;
              continue;
            }
          }
        } else if (i) {
          if (dp[i][i0][p] == dp[i - 1][i0][p + 1] + 1) {
            ans += s[i - 1];
            i--, p++;
            continue;
          }
          if (dp[i][i0][p] == dp[i - 1][i0][p] + 2) {
            i--;
            ans += ")(";
            continue;
          }
        }
        if (i0 && t[i0 - 1] == '(') {
          if (p) {
            if (dp[i][i0][p] == dp[i][i0 - 1][p - 1] + 1) {
              ans += t[i0 - 1];
              i0--, p--;
              continue;
            }
          }
        } else if (i0) {
          if (dp[i][i0][p] == dp[i][i0 - 1][p + 1] + 1) {
            ans += t[i0 - 1];
            i0--, p++;
            continue;
          }
          if (dp[i][i0][p] == dp[i][i0 - 1][p] + 2) {
            i0--;
            ans += ")(";
            continue;
          }
        }
      }
      reverse(ans.begin(), ans.end());
      while (x--) ans += ')';
      cout << ans << endl;
      break;
    }
  }
  return 0;
}
