#include <bits/stdc++.h>
using namespace std;
void fre() {
  freopen("c://test//input.in", "r", stdin);
  freopen("c://test//output.out", "w", stdout);
}
template <class T1, class T2>
inline void gmax(T1 &a, T2 b) {
  if (b > a) a = b;
}
template <class T1, class T2>
inline void gmin(T1 &a, T2 b) {
  if (b < a) a = b;
}
const int N = 1e5 + 10, M = 0, Z = 1e9 + 7, inf = 0x3f3f3f3f;
template <class T1, class T2>
inline void gadd(T1 &a, T2 b) {
  a = (a + b) % Z;
}
int casenum, casei;
int n;
char a[N], b[N];
struct ANS {
  int len, l, r;
  void update(const ANS &b) {
    if (len < b.len) {
      *this = b;
    }
  }
};
int befMatch[N];
int behMatch[N];
int main() {
  while (~scanf("%s%s", a + 1, b + 1)) {
    int n = strlen(a + 1);
    int m = strlen(b + 1);
    ANS ans = {0, 0, 0};
    for (int i = 1, p = 1; i <= m; ++i) {
      while (p <= n && a[p] != b[i]) ++p;
      befMatch[i] = p;
      if (p <= n) {
        ans.update({i, i + 1, m});
        ++p;
      }
    }
    for (int i = m, p = n; i >= 1; --i) {
      while (p >= 1 && a[p] != b[i]) --p;
      behMatch[i] = p;
      if (p >= 1) {
        ans.update({m - i + 1, 1, i - 1});
        --p;
      }
    }
    for (int i = 1, j = 1; i <= m; ++i) {
      int bef = befMatch[i];
      while (j <= m && behMatch[j] <= befMatch[i]) ++j;
      if (j <= m) {
        ans.update({i + m - j + 1, i + 1, j - 1});
      }
    }
    if (ans.len == 0)
      puts("-");
    else {
      for (int i = 1; i <= m; ++i) {
        if (i < ans.l || i > ans.r) {
          putchar(b[i]);
        }
      }
      puts("");
    }
  }
  return 0;
}
