#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
char s[N];
string a, b;
int nxt[N][26], prv[N][26];
int l[N], r[N];
int main() {
  scanf("%s", s);
  a = s;
  scanf("%s", s);
  b = s;
  memset(nxt, -1, sizeof(nxt));
  memset(prv, -1, sizeof(prv));
  for (int i = a.size() - 1; i >= 0; --i) {
    for (int j = 0; j < 26; ++j) nxt[i][j] = nxt[i + 1][j];
    nxt[i][a[i] - 'a'] = i;
  }
  prv[0][a[0] - 'a'] = 0;
  for (int i = 1; i < a.size(); ++i) {
    for (int j = 0; j < 26; ++j) prv[i][j] = prv[i - 1][j];
    prv[i][a[i] - 'a'] = i;
  }
  memset(l, -1, sizeof(l));
  memset(r, -1, sizeof(r));
  int cur = 0;
  for (int i = 0; cur < a.size() && i < b.size(); ++i) {
    if (nxt[cur][b[i] - 'a'] == -1) break;
    cur = nxt[cur][b[i] - 'a'] + 1;
    l[i] = cur - 1;
  }
  cur = a.size() - 1;
  for (int i = b.size() - 1; cur >= 0 && i >= 0; --i) {
    if (prv[cur][b[i] - 'a'] == -1) break;
    cur = prv[cur][b[i] - 'a'] - 1;
    r[i] = cur + 1;
  }
  int ansL = 0, res = b.size();
  for (int take = 0; take <= b.size(); ++take) {
    if (take && l[take - 1] == -1) break;
    int idx;
    if (take == 0)
      idx = 0;
    else
      idx = l[take - 1] + 1;
    int it = lower_bound(r, r + b.size(), idx) - r - 1;
    int rem = it - take + 1;
    rem = max(rem, 0);
    if (rem < res) {
      res = rem;
      ansL = take;
    }
  }
  string ans;
  ans = b.substr(0, ansL) + b.substr(ansL + res);
  if (ans.empty()) ans = "-";
  puts(ans.c_str());
  return 0;
}
