#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
string a, b;
int n;
int x[MAXN], y[MAXN];
void pre() {
  int cnt = 0, len = b.size();
  for (int i = 0; i < n; i++) {
    if (cnt == len) continue;
    if (b[cnt] == a[i]) {
      x[cnt] = i;
      cnt++;
    }
  }
  cnt = len - 1;
  for (int i = n - 1; i >= 0; i--) {
    if (cnt < 0) continue;
    if (b[cnt] == a[i]) {
      y[cnt] = n - 1 - i;
      cnt--;
    }
  }
}
int bs(int val, int in) {
  int s = 0, e = in, mid;
  while (s <= e) {
    mid = (s + e) / 2;
    if (x[mid] < val)
      s = mid + 1;
    else if (x[mid] > val)
      e = mid - 1;
    else
      return mid;
  }
  return e;
}
int main() {
  ios::sync_with_stdio(NULL);
  cin.tie(0);
  cin >> a;
  cin >> b;
  n = a.size();
  std::fill(x, x + b.size(), MAXN);
  std::fill(y, y + b.size(), MAXN);
  pre();
  int ani = MAXN, len = b.size();
  pair<int, int> ans = make_pair(-1, len);
  for (int i = len - 1; i >= 0; i--) {
    int an = bs(n - 1 - y[i], i - 1);
    if (ani > i - an - 1) {
      if (an == -1 && y[i] >= n) continue;
      if (an != -1 && x[an] + y[i] + 1 >= n) continue;
      ani = i - an - 1;
      ans = make_pair(an, i);
    }
  }
  for (int i = 0; i < len; i++)
    if (x[i] < n && len - i - 1 < ani) {
      ani = len - i - 1;
      ans = make_pair(i, len);
    }
  if (ans.first == -1 && ans.second == len)
    cout << "-\n";
  else {
    if (ans.first != -1) cout << b.substr(0, ans.first + 1);
    if (ans.second != len) cout << b.substr(ans.second, len - ans.second);
    cout << "\n";
  }
}
