#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 1;
const int mod = (int)1e9 + 7;
string a, b;
int pref[N], suff[N], ind, l, r, sz;
bool check(int x) {
  for (int i = 0; i <= b.size() - x; i++) {
    l = i - 1, r = i + x;
    int x = -100, y = N;
    if (l >= 0) x = pref[l];
    if (r < b.size()) y = suff[r];
    if (x == -1 || y == -1) continue;
    if (x < y) return true;
  }
  return false;
}
int main() {
  cin >> a >> b;
  for (int i = 0; i <= b.size(); i++) pref[i] = suff[i] = -1;
  for (int i = 0; i < a.size(); i++) {
    if (a[i] == b[ind]) pref[ind] = i, ind++;
  }
  ind = b.size() - 1;
  for (int i = a.size() - 1; i >= 0; i--) {
    if (a[i] == b[ind]) suff[ind] = i, ind--;
  }
  int low = 0, high = b.size();
  while (high - low > 1) {
    int mid = (low + high) >> 1;
    if (check(mid))
      high = mid;
    else
      low = mid;
  }
  if (check(low))
    sz = low;
  else
    sz = high;
  check(sz);
  if (sz == b.size()) {
    puts("-");
  } else {
    for (int i = 0; i <= l; i++) cout << b[i];
    for (int i = r; i < b.size(); i++) cout << b[i];
  }
  return 0;
}
