#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 123;
int in[N], inl;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int l = 0, r, ans = 0;
  string a, b;
  cin >> a >> b;
  r = b.size();
  int i = 0;
  for (int j = 0; j < b.size(); j++) {
    while (i < a.size() && a[i] != b[j]) i++;
    if (i < a.size()) {
      l = j + 1;
      ans = l;
      in[inl++] = i;
    }
    i++;
  }
  i = a.size() - 1;
  for (int j = b.size() - 1; j >= 0; j--) {
    while (i > -1 && a[i] != b[j]) i--;
    if (i > -1) {
      int o = lower_bound(in, in + inl, i) - in;
      o = min(o, j - 1);
      if (o + b.size() - j > ans) {
        l = o;
        r = j;
        ans = o + b.size() - j;
      }
    }
    i--;
  }
  if (r == b.size() && l < 1) return cout << '-' << endl, 0;
  for (int i = 0; i < l; i++) cout << b[i];
  for (int i = r; i < b.size(); i++) cout << b[i];
  cout << endl;
  return 0;
}
