#include <bits/stdc++.h>
using namespace std;
const int maxn = int(1e5) + 100;
struct strings {
  int len;
  char a[maxn];
  void read() {
    char ch;
    while ((ch = getchar()) < 'a' || ch > 'z')
      ;
    a[len = 1] = ch;
    while ((ch = getchar()) >= 'a' && ch <= 'z') a[++len] = ch;
  }
};
strings st, str;
int le[maxn], ri[maxn];
void init() {
  for (int i = 1; i <= str.len; ++i) {
    le[i] = st.len + 1;
    ri[i] = 0;
  }
  le[0] = 0;
  ri[str.len + 1] = st.len + 1;
  for (int i = 1, j = 1; i <= st.len && j <= str.len; ++i)
    if (st.a[i] == str.a[j]) {
      le[j] = i;
      ++j;
    }
  for (int i = st.len, j = str.len; i > 0 && j > 0; --i)
    if (st.a[i] == str.a[j]) {
      ri[j] = i;
      --j;
    }
}
bool check(int step) {
  for (int i = 0; i <= str.len - step; ++i)
    if (le[i] < ri[i + step + 1]) return true;
  return false;
}
void print(int step) {
  if (step == str.len) {
    printf("-\n");
    return;
  }
  for (int i = 0; i <= str.len - step; ++i)
    if (le[i] < ri[i + step + 1]) {
      for (int j = 1; j <= i; ++j) putchar(str.a[j]);
      for (int j = i + step + 1; j <= str.len; ++j) putchar(str.a[j]);
      return;
    }
}
void solve() {
  int L = -1, R = str.len;
  while (L + 1 < R) {
    int mid = (L + R) >> 1;
    if (check(mid))
      R = mid;
    else
      L = mid;
  }
  print(R);
}
int main() {
  st.read();
  str.read();
  init();
  solve();
  return 0;
}
