#include <bits/stdc++.h>
using namespace std;
const int Nmax = 1e5 + 5;
string s, t;
int n, m, pos, l, r;
int pre[Nmax];
int suf[Nmax];
int main() {
  cin >> s;
  cin >> t;
  n = s.size();
  m = t.size();
  s = ' ' + s;
  t = ' ' + t;
  pos = 1;
  for (int i = 1; i <= m; i++) {
    while (pos <= n && s[pos] != t[i]) pos++;
    if (pos > n) break;
    pre[pos++] = i;
  }
  for (int i = 1; i <= n; i++) {
    if (pre[i] == 0) pre[i] = pre[i - 1];
  }
  pos = n;
  for (int i = m; i >= 1; i--) {
    while (pos > 0 && s[pos] != t[i]) pos--;
    if (pos == 0) break;
    suf[pos--] = m - i + 1;
  }
  for (int i = n; i >= 1; i--) {
    if (suf[i] == 0) suf[i] = suf[i + 1];
  }
  for (int i = 0; i <= n; i++) {
    if (pre[i] + suf[i + 1] > l + r) {
      l = pre[i];
      r = suf[i + 1];
    }
  }
  if (l + r == 0)
    cout << "-";
  else {
    if (l + r > m) {
      for (int i = 1; i <= m; i++) cout << t[i];
      return 0;
    }
    for (int i = 1; i <= l; i++) cout << t[i];
    for (int i = m - r + 1; i <= m; i++) cout << t[i];
  }
  return 0;
}
