#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:247474112")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
template <typename T, typename... Types>
void print(T var1, Types... var2) {
  cout << var1 << " ";
}
long long mod = 1e9 + 7;
void print_width(long long x) {
  std::cout << std::fixed;
  std::cout << std::setprecision(x);
}
bool sortinrev(const pair<long long, long long> &a,
               const pair<long long, long long> &b) {
  return (a.first > b.first);
}
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long lcm(long long a, long long b) { return ((a * b) / gcd(a, b)); }
long long isPrime(long long n) {
  if (n < 2) return 0;
  if (n < 4) return 1;
  if (n % 2 == 0 or n % 3 == 0) return 0;
  for (long long i = 5; i * i <= n; i += 6)
    if (n % i == 0 or n % (i + 2) == 0) return 0;
  return 1;
}
long long nCr(long long n, long long r) {
  if (r > n - r) r = n - r;
  long long ans = 1;
  long long i;
  for (i = 1; i <= r; i++) {
    ans *= n - r + i;
    ans /= i;
  }
  return ans;
}
long long modexpo(long long x, long long p) {
  long long res = 1;
  x = x % mod;
  while (p) {
    if (p % 2) res = res * x;
    p >>= 1;
    x = x * x % mod;
    res %= mod;
  }
  return res;
}
long long sti(string s) {
  long long ans = 0;
  long long p = 1;
  for (long long i = s.size() - 1; i >= 0; i--) {
    ans = (ans + ((long long)(s[i] - '0') * p) % mod) % mod;
    p = (p * 10) % mod;
  }
  return ans;
}
const long long N = 1e6 + 5;
const long long despacito = 1e9 + 7;
void solve() {
  long long i, j;
  string s, t, ans;
  cin >> s >> t;
  long long n = s.size(), m = t.size();
  vector<long long> pref(m), suf(m);
  for (long long i = 0, j = 0; i < m; i++) {
    while (j < n and s[j] != t[i]) j++;
    pref[i] = j;
    j = (j + 1 <= n ? j + 1 : n);
  }
  for (long long i = m - 1, j = n - 1; ~i; i--) {
    while (~j and s[j] != t[i]) j--;
    suf[i] = j;
    j = (j - 1 >= -1 ? j - 1 : -1);
  }
  auto check = [&](long long x) {
    for (long long i = 0; i + x <= m; i++) {
      if ((i ? pref[i - 1] : -1) < (i + x < m ? suf[i + x] : n)) return i;
    }
    return (long long)-1;
  };
  auto binary_search = [&](long long l, long long h) {
    while (l <= h) {
      long long m = (l + h) / 2;
      if (~check(m)) {
        h = m - 1;
      } else
        l = m + 1;
    }
    return l;
  };
  long long x = binary_search(0, m);
  long long y = check(x);
  ans = t.substr(0, y) + t.substr(y + x);
  if (!ans.size()) {
    ans = '-';
  }
  cout << ans << "\n";
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  solve();
  return 0;
}
