#include <bits/stdc++.h>
using namespace std;
const int MAX = 200010;
char a[MAX], b[MAX];
int pre[MAX], suf[MAX];
int main() {
  scanf("%s%s", a + 1, b + 1);
  int l1 = strlen(a + 1);
  int l2 = strlen(b + 1);
  for (int i = 1, j = 0; i <= l2; i++) {
    j++;
    while (b[i] != a[j] && j <= l1) {
      j++;
    }
    pre[i] = j;
  }
  for (int i = l2, j = l1 + 1; i >= 1; i--) {
    j--;
    while (b[i] != a[j] && j > 0) {
      j--;
    }
    suf[i] = j;
  }
  suf[l2 + 1] = l1 + 1;
  int l = 0, r = l2;
  int ans1, ans2;
  while (l <= r) {
    int mid = (l + r) >> 1, i;
    for (i = 0; i + mid <= l2; i++) {
      if (pre[i] < suf[i + mid + 1]) {
        break;
      }
    }
    if (i + mid <= l2) {
      ans1 = i;
      ans2 = i + mid + 1;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  if (ans2 - ans1 > l2) {
    cout << "-\n";
  } else {
    for (int i = 1; i <= ans1; i++) {
      cout << b[i];
    }
    for (int i = ans2; i <= l2; i++) {
      cout << b[i];
    }
    cout << '\n';
  }
  return 0;
}
