#include <bits/stdc++.h>
using namespace std;
const long long PR = 1000000009;
int n, m, premin[100009], sufmax[100009];
char A[100009], B[100009];
int main() {
  ios::sync_with_stdio(false);
  cin >> A >> B;
  n = strlen(A);
  m = strlen(B);
  for (int i = 0; i < m; i++) premin[i] = n, sufmax[i] = -1;
  int st = 0;
  for (int i = 0; i < m && st < n; i++) {
    while (A[st] != B[i]) {
      st++;
      if (st >= n) break;
    }
    premin[i] = st;
    st++;
  }
  st = n - 1;
  for (int i = m - 1; i >= 0 && st >= 0; i--) {
    while (A[st] != B[i]) {
      st--;
      if (st < 0) break;
    }
    sufmax[i] = st;
    st--;
  }
  int ans = m, i1 = -1, j1 = -1;
  for (int i = 0; i < m; i++) {
    if (premin[i] != n) {
      int mid, st = i + 1, end = m - 1;
      while (st < end) {
        mid = (st + end) / 2;
        if (sufmax[mid] >= premin[i] + 1)
          end = mid;
        else
          st = mid + 1;
      }
      if (sufmax[st] < premin[i] + 1) st = m;
      int now = st - i - 1;
      if (now < ans) {
        i1 = i + 1;
        j1 = st - 1;
        ans = now;
      }
    }
  }
  for (int i = m - 1; i >= 0; i--) {
    if (sufmax[i] == -1) break;
    int now = i - 1;
    if (now < ans) {
      j1 = i - 1;
      i1 = 0;
      ans = now;
    }
  }
  if (i1 == -1 || j1 - i1 + 1 == m) {
    cout << '-' << endl;
    return 0;
  }
  for (int i = 0; i < i1; i++) cout << B[i];
  for (int j = j1 + 1; j < m; j++) cout << B[j];
  cout << endl;
  return 0;
};
