#include <bits/stdc++.h>
using namespace std;
string s, t;
int pre[110000], suf[110000];
int ite = 0;
int best, l, r;
string ans;
int32_t main() {
  ios_base::sync_with_stdio(false);
  if (fopen("cf762c.in", "r")) {
    freopen("cf762c.in", "r", stdin);
    freopen("cf762c.out", "w", stdout);
  }
  cin >> s >> t;
  l = 0;
  r = t.length() - 1;
  for (int i = 0; i < t.length(); i++) {
    pre[i] = s.length();
    suf[i] = -1;
  }
  for (int i = 0; i < t.length(); i++) {
    while (ite < s.length()) {
      if (s[ite] == t[i]) {
        pre[i] = ite;
        ite++;
        break;
      }
      ite++;
    }
  }
  ite = s.length() - 1;
  for (int i = t.length() - 1; i >= 0; i--) {
    while (ite >= 0) {
      if (s[ite] == t[i]) {
        suf[i] = ite;
        ite--;
        break;
      }
      ite--;
    }
  }
  for (int i = t.length() - 1; i >= 0; i--) {
    if (suf[i] != -1) {
      best = t.length() - i;
      l = 0;
      r = i - 1;
    }
  }
  for (int i = 0; i < t.length(); i++) {
    if (pre[i] != s.length() && best < i + 1) {
      best = i + 1;
      l = i + 1;
      r = t.length() - 1;
    }
  }
  for (int i = 0; i < t.length(); i++) {
    if (pre[i] >= s.length()) {
      continue;
    }
    int u = upper_bound(suf, suf + t.length(), pre[i]) - suf;
    if (u >= t.length()) {
      continue;
    }
    if (i + 1 + (t.length() - u) > best) {
      best = i + 1 + (t.length() - u);
      l = i + 1;
      r = u - 1;
    }
  }
  for (int i = 0; i < t.length(); i++) {
    if (l <= i && i <= r) {
      continue;
    }
    ans += t[i];
  }
  if (ans == "") {
    ans = "-";
  }
  cout << ans << '\n';
  return 0;
}
