#include <bits/stdc++.h>
using namespace std;
vector<int> l, r;
int main() {
  string a, b;
  cin >> a >> b;
  int n = a.size();
  int m = b.size();
  int x = 0;
  for (int i = 0; i < m; i++) {
    if (a[x] == b[i])
      l.push_back(x);
    else
      i--;
    x++;
    if (x == n) break;
  }
  x = n - 1;
  for (int i = m - 1; i >= 0; i--) {
    if (a[x] == b[i])
      r.push_back(x);
    else
      i++;
    x--;
    if (x < 0) break;
  }
  sort(r.begin(), r.end());
  int ans = 1000000007;
  int ind = -1;
  if (l.size() != 0) {
    ans = m - l.size();
    ind = l.size();
  }
  if (r.size() != 0) {
    if (ans > m - r.size()) {
      ans = m - r.size();
      ind = 0;
    }
  }
  for (int i = 0; i < l.size(); i++) {
    if (r.size() == 0) break;
    int x = upper_bound(r.begin(), r.end(), l[i]) - r.begin();
    if (r.back() <= l[i])
      x = m - i - 1;
    else
      x = m - 1 - (r.size() - x - 1) - i - 1;
    x = max(x, 0);
    if (ans > x) {
      ans = x;
      ind = i + 1;
    }
  }
  if (ans == 1000000007 || ans == m)
    cout << "-";
  else {
    cout << b.substr(0, ind) + b.substr(ind + ans, m - ind - ans + 1);
  }
  return 0;
}
