#include <bits/stdc++.h>
using namespace std;
void try_it(string& a, string& b, vector<int>& sol) {
  int cr = 0;
  for (int i = 0; i < a.size(); ++i) {
    if (a[i] == b[cr]) ++cr;
    sol[i] = cr;
  }
}
void solve() {
  string a, b;
  cin >> a >> b;
  vector<int> fr(a.size());
  try_it(a, b, fr);
  vector<int> bck(a.size());
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  try_it(a, b, bck);
  reverse(bck.begin(), bck.end());
  int frontans = 0, backans = 0;
  for (int i = -1; i < (int)fr.size(); ++i) {
    int frontnow, backnow;
    if (i == -1) {
      frontnow = 0;
    } else {
      frontnow = fr[i];
    }
    if (i + 1 == fr.size()) {
      backnow = 0;
    } else {
      backnow = bck[i + 1];
    }
    if (frontnow + backnow > frontans + backans) {
      frontans = frontnow;
      backans = backnow;
    }
  }
  if (frontans + backans == 0) {
    cout << "-\n";
    return;
  }
  reverse(b.begin(), b.end());
  for (int i = 0; i < frontans; ++i) cout << b[i];
  for (int j = max(frontans, (int)b.size() - backans); j < b.size(); ++j)
    cout << b[j];
  cout << "\n";
}
void reset() {}
int main() {
  int k = 1;
  for (; k <= 1; ++k) {
    solve();
  }
}
