#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
const double pi = 3.14159265358979323846264338;
inline long long multi(long long x, long long y) {
  long long tmp =
      (x * y -
       (long long)((long double)x / 998244353 * y + 1.0e-8) * 998244353);
  return tmp < 0 ? tmp + 998244353 : tmp;
}
using namespace std;
char a[100005], b[100005];
int fl[100005], fr[100005];
int la, lb, i, j, mid, l, r, a1, a2;
int main() {
  scanf("%s%s", a + 1, b + 1);
  la = strlen(a + 1);
  lb = strlen(b + 1);
  for (i = 1, fl[0] = j = 0; b[i]; i++) {
    for (j++; j <= la && a[j] != b[i]; j++)
      ;
    fl[i] = j;
  }
  for (i = lb, fr[lb + 1] = j = la + 1; b[i]; i--) {
    for (j--; j > 0 && a[j] != b[i]; j--)
      ;
    fr[i] = j;
  }
  for (l = 0, r = lb; l <= r;) {
    mid = (l + r) >> 1;
    for (i = 0; i + mid <= lb; i++)
      if (fl[i] < fr[i + mid + 1]) break;
    if (i + mid <= lb)
      a1 = i, a2 = mid + i + 1, r = mid - 1;
    else
      l = mid + 1;
  }
  for (int i = 1; i <= a1; i++) putchar(b[i]);
  for (int i = a2; i <= lb; i++) putchar(b[i]);
  if (a2 - a1 > lb) putchar('-');
  return 0;
}
