#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
const int inf = 1e9;
char s[MAXN];
char t[MAXN];
int pre[MAXN];
int suf[MAXN];
int main() {
  scanf("%s\n%s", s + 1, t + 1);
  int lens = strlen(s + 1);
  int lent = strlen(t + 1);
  for (int i = 1; i <= lent; i++) pre[i] = inf;
  for (int i = 1; i <= lent; i++) suf[i] = 0;
  int pos = 0;
  for (int i = 1; i <= lent; i++) {
    bool flag = false;
    while (pos + 1 <= lens) {
      pos++;
      if (s[pos] == t[i]) {
        pre[i] = pos;
        flag = true;
        break;
      }
    }
    if (!flag) break;
  }
  pos = lens + 1;
  for (int i = lent; i >= 1; i--) {
    bool flag = false;
    while (pos - 1 > 0) {
      pos--;
      if (s[pos] == t[i]) {
        suf[i] = pos;
        flag = true;
        break;
      }
    }
    if (!flag) break;
  }
  int l = 1, r = lent;
  for (int i = 1; i <= lent; i++) {
    int p = upper_bound(suf + 1, suf + lent + 1, pre[i]) - suf;
    if (p == lent + 1) continue;
    if (p <= i) p = i + 1;
    if ((p - 1) - (i + 1) < r - l) l = i + 1, r = p - 1;
  }
  for (int i = 1; i <= lent; i++) {
    if (pre[i] != inf && lent - (i + 1) < r - l) l = i + 1, r = lent;
    if (suf[i] != 0 && (i - 1) - 1 < r - l) l = 1, r = i - 1;
  }
  if (l == 1 && r == lent)
    puts("-");
  else {
    for (int i = 1; i < l; i++) printf("%c", t[i]);
    for (int i = r + 1; i <= lent; i++) printf("%c", t[i]);
  }
  return 0;
}
