#include <bits/stdc++.h>
using namespace std;
vector<long long> fw[26], rv[26];
long long bf[100050], br[100050];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string a, b;
  cin >> a >> b;
  for (long long i = 0; i < a.length(); i++) fw[a[i] - 'a'].push_back(i);
  for (long long j = a.length() - 1; j >= 0; j--)
    rv[a[j] - 'a'].push_back(a.length() - 1 - j);
  memset(bf, -1, sizeof(bf));
  memset(br, -1, sizeof(br));
  for (long long i = 0; i < b.length(); i++) {
    long long x = bf[i];
    long long k = upper_bound(fw[b[i] - 'a'].begin(), fw[b[i] - 'a'].end(), x) -
                  fw[b[i] - 'a'].begin();
    if (k == fw[b[i] - 'a'].size()) break;
    bf[i + 1] = fw[b[i] - 'a'][k];
  }
  for (long long j = b.length() - 1; j >= 0; j--) {
    long long x = br[j + 2];
    long long k = upper_bound(rv[b[j] - 'a'].begin(), rv[b[j] - 'a'].end(), x) -
                  rv[b[j] - 'a'].begin();
    if (k == rv[b[j] - 'a'].size()) break;
    br[j + 1] = rv[b[j] - 'a'][k];
  }
  for (long long i = 1; i < b.length() + 1; i++)
    if (br[i] != -1) br[i] = a.length() - br[i] - 1;
  long long lp = 1, rp = 1, mn = 1e18, l = -1, r = -1;
  long long k1 = 0, k2 = 0;
  for (long long i = 1; i < b.length() + 1; i++) {
    if (bf[i] == -1) break;
    k1++;
  }
  for (long long j = b.length(); j >= 1; j--) {
    if (br[j] == -1) break;
    k2++;
  }
  if (k1 == b.length() || k2 == b.length()) {
    cout << b;
    return 0;
  }
  while (lp <= b.length() && rp <= b.length()) {
    if (bf[lp] == -1) break;
    while (rp <= b.length() && br[rp] < bf[lp]) rp++;
    if (bf[lp] == br[rp] && lp != rp) rp++;
    if (rp > b.length()) break;
    long long k = rp - lp;
    if (k < mn) {
      mn = k;
      l = lp - 1;
      r = rp - 1;
    }
    lp++;
  }
  if (k1 != 0 && b.length() - k1 < mn)
    mn = b.length() - k1, l = k1 - 1, r = 1e18;
  if (k2 != 0 && b.length() - k2 < mn)
    mn = b.length() - k2, l = -1, r = b.length() - k2;
  if (l == -1 && r == -1) {
    cout << "-";
    return 0;
  }
  if (l == r) r++;
  for (long long i = 0; i < l + 1; i++) cout << b[i];
  for (long long i = r; i < b.length(); i++) cout << b[i];
  return 0;
}
