#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2;
string a, b;
pair<int, int> pre[N], sur[N];
int kq;
int main() {
  cin >> a >> b;
  int j = 0;
  for (int i = 0; i < a.length(); ++i) {
    if (j < b.length() && b[j] == a[i]) {
      pre[i].first = j + 1;
      ++j;
    } else
      pre[i].first = j;
  }
  j = b.length() - 1;
  for (int i = a.length() - 1; i >= 0; --i)
    if (j >= 0 && b[j] == a[i]) {
      sur[i].first = b.length() - j;
      --j;
    } else
      sur[i].first = b.length() - j - 1;
  int t1 = -2, t2 = -2;
  for (int i = 0; i < a.length(); ++i)
    if (pre[i].first - 1 < b.length() - sur[i + 1].first &&
        pre[i].first + sur[i + 1].first > kq) {
      kq = pre[i].first + sur[i + 1].first;
      t1 = pre[i].first;
      t2 = sur[i + 1].first;
    }
  if (sur[0].first > kq) {
    kq = sur[0].first;
    t1 = 0;
    t2 = sur[0].first;
  }
  string s = "";
  if (t1 == -2) {
    cout << '-';
    return 0;
  }
  for (int i = 0; i < t1; ++i) s += b[i];
  for (int i = b.length() - t2; i < b.length(); ++i) s += b[i];
  cout << s;
}
