#include <bits/stdc++.h>
using namespace std;
int n, m, l, r, p[100002];
char a[100002], b[100002];
int main() {
  int i, j, k;
  scanf("%s%s", a, b);
  n = strlen(a);
  m = strlen(b);
  p[m] = n;
  for (i = m - 1, j = n - 1; i; i--) {
    while (b[i] != a[j] && j > 0) j--;
    if (b[i] != a[j] || j < 0) break;
    p[i] = j;
    j--;
  }
  k = i + 1;
  l = -1;
  r = k;
  if (r != 0)
    for (i = j = 0; i < m; i++) {
      while (b[i] != a[j] && j < n) j++;
      if (b[i] != a[j] || j >= n) break;
      while (p[k] <= j || k <= i) k++;
      if (k - i < r - l) r = k, l = i;
      if (k - i == 1) break;
      j++;
    }
  if (r - l - 1 == m) return puts("-"), 0;
  for (i = 0; i <= l; i++) putchar(b[i]);
  for (i = r; i < m; i++) putchar(b[i]);
}
