#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
inline long long mpow(long long b, long long ex) {
  if (b == 1) return 1;
  long long r = 1;
  while (ex) {
    if (ex & 1) r = (r * b) % mod;
    ex = ex >> 1;
    b = (b * b) % mod;
  }
  return r;
}
int main() {
  ios_base::sync_with_stdio(0);
  string a, b;
  cin >> a;
  cin >> b;
  int n = a.length();
  int m = b.length();
  std::vector<int> inc(m, -1), desc(m + 1, -1);
  desc[m] = n;
  int j = 0;
  for (int i = 0; i < n and j < m; ++i) {
    if (a[i] == b[j]) {
      inc[j++] = i;
    }
  }
  j = m - 1;
  for (int i = n - 1; i >= 0 and j >= 0; --i) {
    if (a[i] == b[j]) {
      desc[j--] = i;
    }
  }
  int best = -1;
  j = 0;
  int besti = -1, bestj = m;
  for (int i = -1; i < m; ++i) {
    while (j < m + 1 and
           (j <= i || desc[j] == -1 || desc[j] <= (i == -1 ? -1 : inc[i]))) {
      j++;
    }
    if (j == m + 1) {
      break;
    }
    if (inc[i] != -1 and bestj - besti > j - i) {
      bestj = j;
      besti = i;
    }
  }
  if (besti == -1 and bestj == m) {
    cout << "-\n";
  } else {
    cout << (besti == -1 ? "" : b.substr(0, besti + 1))
         << (bestj == m ? "" : b.substr(bestj, m - bestj)) << "\n";
  }
  return 0;
}
