#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int pre[maxn], suf[maxn];
char a[maxn], b[maxn];
int main() {
  while (~scanf("%s", a + 1)) {
    scanf("%s", b + 1);
    int l1 = strlen(a + 1), l2 = strlen(b + 1), last = 0;
    for (int i = 1; i <= l1; i++) pre[i] = l2, suf[i] = 1;
    suf[l1 + 1] = l2 + 1;
    for (int i = 1, j = 1; i <= l1 && j <= l2; i++) {
      if (a[i] == b[j])
        pre[i] = j, last = j, j++;
      else
        pre[i] = last;
    }
    last = l2 + 1;
    for (int i = l1, j = l2; i >= 1 && j >= 1; i--) {
      if (a[i] == b[j])
        suf[i] = j, last = j, j--;
      else
        suf[i] = last;
    }
    int ans = l2 + 1, l, r;
    for (int i = 1; i <= l1 + 1; i++) {
      if (pre[i - 1] < suf[i]) {
        if (ans > suf[i] - pre[i - 1]) {
          ans = suf[i] - pre[i - 1];
          l = pre[i - 1];
          r = suf[i];
        }
      }
    }
    if (ans == l2 + 1) {
      cout << "-" << endl;
      continue;
    }
    for (int i = 1; i <= l2; i++) {
      if (i <= l || i >= r) cout << b[i];
    }
  }
  return 0;
}
