#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
char a[maxn], b[maxn];
int pre[maxn], suf[maxn];
int main() {
  scanf("%s%s", a + 1, b + 1);
  int n = strlen(a + 1);
  int m = strlen(b + 1);
  int pos = 0;
  for (int i = 1; b[i]; i++, pos++) {
    while (pos <= n && a[pos] != b[i]) pos++;
    pre[i] = pos;
  }
  pos = n + 1;
  for (int i = m; b[i]; i--, pos--) {
    while (pos > 0 && b[i] != a[pos]) {
      pos--;
    }
    suf[i] = pos;
  }
  suf[m + 1] = n + 1;
  int ans1 = m + 1, ans2 = 0, l = 0, r = m;
  while (l <= r) {
    int mid = l + r >> 1, i;
    for (i = 0; i + mid <= m; ++i)
      if (pre[i] < suf[i + mid + 1]) break;
    if (i + mid <= m) {
      ans1 = i, ans2 = i + mid + 1, r = mid - 1;
    } else
      l = mid + 1;
  }
  if (ans2 - ans1 > m)
    putchar('-');
  else {
    for (int i = 1; i <= ans1; ++i) putchar(b[i]);
    for (int i = ans2; b[i]; ++i) putchar(b[i]);
  }
  return 0;
}
