#include <bits/stdc++.h>
using namespace std;
char a[100100], b[100100];
int bg_go[100100], en_go[100100];
int main() {
  gets(a);
  gets(b);
  for (int j = 0, i = 0; b[j]; j++) {
    while (a[i] && a[i] != b[j]) i++;
    bg_go[j] = i;
    if (a[i]) i++;
  }
  for (int j = ((int)strlen(b)) - 1, i = ((int)strlen(a)) - 1; j >= 0; j--) {
    while (i >= 0 && a[i] != b[j]) i--;
    en_go[j] = i;
    if (i >= 0) i--;
  }
  int min_len = 1000000000, min_bg = -1;
  int a_len = (int)strlen(a);
  int b_len = (int)strlen(b);
  for (int j = 0; b[j]; j++) {
    int down = 0, up = b_len - j + 1;
    while (up > down) {
      int mid = (up + down) / 2;
      int a_p = -1;
      if (j >= 1) a_p = bg_go[j - 1];
      int b_p = a_len;
      if (j + mid < b_len) b_p = en_go[j + mid];
      if (a_p < b_p)
        up = mid;
      else
        down = mid + 1;
    }
    if (down <= b_len - j && down < min_len) {
      min_len = down;
      min_bg = j;
    }
  }
  if (min_len >= b_len)
    cout << "-";
  else {
    for (int i = 0; i < min_bg; i++) printf("%c", b[i]);
    for (int i = min_bg + min_len; b[i]; i++) printf("%c", b[i]);
  }
  return 0;
}
