#include <bits/stdc++.h>
using namespace std;
const int N = 100000, M = 100000;
int n, m;
char a[N + 5], b[M + 5];
int Pos[M + 1], poS[M + 2];
int main() {
  cin >> a + 1 >> b + 1;
  n = strlen(a + 1);
  m = strlen(b + 1);
  for (int i = 1; i <= m; i++) {
    Pos[i] = Pos[i - 1] + 1;
    while (Pos[i] <= n && a[Pos[i]] != b[i]) Pos[i]++;
  }
  poS[m + 1] = n + 1;
  for (int i = m; i; i--) {
    poS[i] = poS[i + 1] - 1;
    while (poS[i] >= 1 && a[poS[i]] != b[i]) poS[i]--;
  }
  pair<int, pair<int, int> > ans(0, make_pair(0, 0));
  for (int i = 0; i <= m; i++)
    if (poS[m - i + 1] >= 1) {
      int fd = lower_bound(Pos + 1, Pos + m + 1, poS[m - i + 1]) - 1 - Pos;
      fd = min(fd, m - i);
      ans = max(ans, make_pair(fd + i, make_pair(fd, i)));
    }
  for (int i = 1; i <= ans.second.first; i++) cout << b[i];
  for (int i = m - ans.second.second + 1; i <= m; i++) cout << b[i];
  if (ans.second.first == 0 && ans.second.second == 0) puts("-");
  return 0;
}
