#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1;
string s, t;
int arr[N];
int main() {
  cin >> s >> t;
  int i = s.size() - 1, j = t.size() - 1;
  arr[s.size()] = t.size();
  while (i >= 0) {
    arr[i] = j + 1;
    if (s[i] == t[j]) {
      arr[i] = j;
      j--;
    }
    i--;
  }
  int mn = 1e6, x = -1, y = -1;
  for (i = 0, j = 0; i < s.size() && j < t.size(); i++) {
    if (mn > arr[i] - j) {
      mn = arr[i] - j;
      x = j;
      y = arr[i] - 1;
    }
    if (s[i] == t[j]) {
      j++;
    }
  }
  if (i == s.size() && j != t.size()) {
    if (mn > arr[i] - j) {
      mn = arr[i] - j;
      x = j;
      y = arr[i] - 1;
    }
  }
  if (mn == t.size())
    cout << '-';
  else
    for (int i = 0; i < t.size(); i++) {
      if (x <= i && i <= y) continue;
      cout << t[i];
    }
  return 0;
}
