#include <bits/stdc++.h>
using namespace std;
int main() {
  iostream::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  string s, c;
  cin >> s >> c;
  swap(s, c);
  vector<int> fw(s.length() + 1, 1e9), bc(s.length() + 1, -1e9);
  int bg = 0;
  fw[0] = -1;
  for (int i = 0; i < s.length(); i++) {
    while (bg < c.length() && c[bg] != s[i]) bg++;
    if (bg == c.length()) break;
    fw[i + 1] = bg++;
  }
  bg = c.length() - 1;
  bc[s.length()] = c.length();
  for (int i = s.length() - 1; i >= 0; i--) {
    while (bg >= 0 && c[bg] != s[i]) bg--;
    if (bg == -1) break;
    bc[i] = bg--;
  }
  int l = -1, r = s.length();
  while (l != r - 1) {
    int m = (l + r) / 2;
    bool is = 0;
    for (int i = 0; i + m <= s.length(); i++) {
      is |= fw[i] < bc[i + m];
    }
    if (is)
      r = m;
    else
      l = m;
  }
  if (r == s.length()) {
    cout << '-';
    return 0;
  }
  for (int i = 0; i + r <= s.length(); i++) {
    if (fw[i] < bc[i + r]) {
      cout << s.substr(0, i);
      cout << s.substr(i + r, s.length() - r - i);
      return 0;
    }
  }
  return 0;
}
