#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  x = 0;
  char ch;
  bool flag = false;
  while (ch = getchar(), ch < '!')
    ;
  if (ch == '-') ch = getchar(), flag = true;
  while (x = 10 * x + ch - '0', ch = getchar(), ch > '!')
    ;
  if (flag) x = -x;
}
inline int cat_max(const int &a, const int &b) { return a > b ? a : b; }
inline int cat_min(const int &a, const int &b) { return a < b ? a : b; }
const int maxn = 200010;
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);
  for (int i = 1, j = 0; b[i]; ++i) {
    ++j;
    while (b[i] != a[j] && j <= n) ++j;
    pre[i] = j;
  }
  for (int i = m, j = n + 1; b[i]; --i) {
    --j;
    while (b[i] != a[j] && j > 0) --j;
    suf[i] = j;
  }
  suf[m + 1] = n + 1;
  int ans1, ans2, 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]);
  }
  getchar();
  getchar();
  return 0;
}
