#include <bits/stdc++.h>
using namespace std;
string x, y;
int lft[100100], rght[100100];
int orig[100100], orim[100100];
int main() {
  cin >> x >> y;
  int k = 1;
  orig[0] = -10100100;
  for (int i = 0; i < x.size(); i++) {
    if (y[k - 1] == x[i]) {
      orig[k] = i;
      k++;
    }
  }
  for (; k <= y.size(); k++) orig[k] = 10100100;
  k = y.size() - 1;
  orim[y.size()] = 10100100;
  for (int i = x.size() - 1; i >= 0; i--) {
    if (y[k] == x[i]) {
      orim[k] = i;
      k--;
    }
  }
  for (; k >= 0; k--) orim[k] = -10100100;
  int mx = -10100100 - 1, mxi, mxj;
  for (int i = 0; i < y.size(); i++) {
    int lo = i, hi = y.size();
    while (lo < hi) {
      int mid = (lo + hi) / 2;
      if (orim[mid] > orig[i])
        hi = mid;
      else
        lo = mid + 1;
    }
    if (orim[lo] > orig[i] && mx < i + ((int)y.size() - lo)) {
      mx = i + ((int)y.size() - lo);
      mxi = i;
      mxj = lo;
    }
  }
  if (mx == 0) {
    cout << '-' << endl;
    return 0;
  }
  for (int i = 0; i < mxi; i++) cout << y[i];
  for (int j = mxj; j < y.size(); j++) cout << y[j];
}
