#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 21;
int len, n, cur, r[maxn], ans, L, R, mid, ansl, ansr;
char T[maxn], s[maxn];
void update(int l, int r) {
  if ((r - l - 1) >= ans) return;
  ans = r - l - 1, ansl = l, ansr = r;
}
int main() {
  scanf("%s%s", T + 1, s + 1);
  len = strlen(T + 1), n = strlen(s + 1);
  cur = n + 1, r[cur] = len + 1;
  for (int i = len; i >= 1; i--)
    if (T[i] == s[cur - 1]) r[--cur] = i;
  cur = 0, ans = n + 1;
  for (int i = 1; i <= n; i++)
    if (r[i]) {
      update(0, i);
      break;
    }
  for (int i = 1; i <= n; i++) {
    cur++;
    while ((cur < len) && (T[cur] != s[i])) cur++;
    if (T[cur] != s[i]) break;
    L = i + 1, R = n + 1;
    while (L < (R - 1)) {
      mid = (L + R) >> 1;
      if (r[mid] > cur)
        R = mid;
      else
        L = mid + 1;
    }
    if (r[L] > cur)
      update(i, L);
    else
      update(i, R);
  }
  if (ans == (n + 1))
    printf("-\n");
  else {
    for (int i = 1; i <= ansl; i++) printf("%c", s[i]);
    for (int i = ansr; i <= n; i++) printf("%c", s[i]);
    printf("\n");
  }
  return 0;
}
