#include <bits/stdc++.h>
using namespace std;
template <class A, class B>
ostream& operator<<(ostream& out, const pair<A, B>& a) {
  return out << "(" << a.first << ", " << a.second << ")";
}
template <class A>
ostream& operator<<(ostream& out, const vector<A>& a) {
  out << "[";
  for (auto it = a.begin(); it != a.end(); ++it) {
    if (it != a.begin()) out << ", ";
    out << *it;
  }
  return out << "]";
}
mt19937 rnd(time(NULL));
mt19937_64 rnd64(time(NULL));
const int INF = 1e9;
const long long INF64 = 1e18;
const int MOD = 1e9 + 7;
const long double PI = acosl(-1.0);
const long double EPS = 1e-9;
const int N = 100 * 1000 + 13;
const int AL = 26;
int n, m;
string s, t;
bool read() {
  static char buf[N];
  if (scanf("%s", buf) != 1) return false;
  s = buf;
  n = int((s).size());
  scanf("%s", buf);
  t = buf;
  m = int((t).size());
  return true;
}
int nxt[N][AL];
int prv[N][AL];
int l[N], r[N];
void solve() {
  for (int i = 0; i < int(AL); ++i) nxt[n][i] = n;
  for (int i = 0; i < int(AL); ++i) prv[0][i] = -1;
  for (int i = n - 1; i >= 0; --i) {
    for (int j = 0; j < int(AL); ++j) nxt[i][j] = nxt[i + 1][j];
    nxt[i][s[i] - 'a'] = i;
  }
  for (int i = 0; i < int(n); ++i) {
    for (int j = 0; j < int(AL); ++j) prv[i + 1][j] = prv[i][j];
    prv[i + 1][s[i] - 'a'] = i;
  }
  l[0] = -1;
  for (int i = 0; i < int(m); ++i) l[i + 1] = nxt[min(n, l[i] + 1)][t[i] - 'a'];
  r[m] = n;
  for (int i = m - 1; i >= 0; --i) r[i] = prv[max(0, r[i + 1])][t[i] - 'a'];
  int j = m;
  while (j - 1 >= 0 && r[j - 1] >= 0) --j;
  int mx = 0;
  int st = -1;
  for (int i = 0; i < int(m + 1); ++i) {
    if (l[i] == n) break;
    while (j < m && (l[i] + 1) + (n - r[j]) > n) ++j;
    j = max(j, i);
    if (m - (j - i) > mx) {
      mx = m - (j - i);
      st = i;
    }
  }
  if (mx == 0)
    puts("-");
  else
    puts((t.substr(0, st) + t.substr(st + m - mx)).c_str());
}
int main() {
  cout << fixed << setprecision(10);
  cerr << fixed << setprecision(10);
  if (read()) {
    solve();
  }
}
