#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
char a[100005], b[100005];
int l[100005], r[100005];
int n, m;
int main() {
  scanf("%s%s", a + 1, b + 1);
  n = strlen(a + 1);
  m = strlen(b + 1);
  l[0] = 0;
  r[n + 1] = m + 1;
  for (int i = 1, j = 1; i <= n; i++) {
    if (j <= m && a[i] == b[j]) j++;
    l[i] = j - 1;
  }
  for (int i = n, j = m; i > 0; i--) {
    if (j > 0 && a[i] == b[j]) j--;
    r[i] = j + 1;
  }
  int L = -1, R = -1, ans = 1e9;
  for (int i = 0; i <= n; i++) {
    if (r[i + 1] - l[i] - 1 < ans) {
      if (r[i + 1] <= l[i]) {
        L = 1;
        R = 2;
      } else {
        L = l[i];
        R = r[i + 1];
      }
      ans = R - L - 1;
    }
  }
  assert(ans != 1e9);
  if (ans == m) {
    puts("-");
  } else {
    for (int i = 1; i <= L; i++) putchar(b[i]);
    for (int i = R; i <= m; i++) putchar(b[i]);
    putchar('\n');
  }
  return 0;
}
