#include <bits/stdc++.h>
using namespace std;
string A, B;
int NA, NB;
int pre[101010];
int post[101010];
void init() {
  NA = A.length();
  NB = B.length();
  int idx = 0;
  for (int i = 0; i < NB; i++) {
    while (idx < NA) {
      if (A[idx] == B[i]) break;
      idx++;
    }
    if (idx == NA) break;
    pre[i + 1] = idx + 1;
    idx++;
  }
  idx = NA - 1;
  for (int _i = 0; _i < NB; _i++) {
    int i = NB - 1 - _i;
    while (0 <= idx) {
      if (A[idx] == B[i]) break;
      idx--;
    }
    if (idx < 0) break;
    post[i + 1] = idx + 1;
    idx--;
  }
}
int main() {
  cin >> A >> B;
  init();
  if (0 < pre[NB]) {
    cout << B << endl;
    return 0;
  }
  int L = 1, R = NB;
  for (int i = 1; i < NB + 1; i++) {
    if (i != 1 && pre[i - 1] <= 0) continue;
    int l = i, r = NB + 1;
    while (l + 1 != r) {
      int c = (l + r) / 2;
      if (pre[i - 1] < post[c])
        r = c;
      else
        l = c;
    }
    if (l - i < R - L) {
      R = l;
      L = i;
    }
  }
  if (L == 1 && R == NB) {
    printf("-\n");
    return 0;
  }
  printf("%s", B.substr(0, L - 1).c_str());
  if (R == NB + 1)
    printf("\n");
  else
    printf("%s\n", B.substr(R).c_str());
}
