#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int start, eend;
int pre[100000], suf[100000];
char s1[100000], s2[100000];
int len1, len2;
bool check(int k, int &pos) {
  if (pre[k - 1] != -1) {
    pos = k - 1;
    return true;
  }
  if (suf[len2 - k] != -1) {
    pos = -1;
    return true;
  }
  for (int i = 0; i < k - 1; i++) {
    if (pre[i] != -1 && suf[len2 + i - k + 1] != -1 &&
        pre[i] < suf[len2 + i - k + 1]) {
      pos = i;
      return true;
    }
  }
  return false;
}
int main() {
  scanf("%s", s1);
  scanf("%s", s2);
  memset(pre, -1, sizeof(pre));
  memset(suf, -1, sizeof(suf));
  len1 = strlen(s1);
  len2 = strlen(s2);
  int i = 0, j = 0;
  while (i < len1 && j < len2) {
    if (s1[i] == s2[j]) {
      pre[j] = i;
      j++;
    }
    i++;
  }
  eend = j;
  i = len1 - 1, j = len2 - 1;
  while (i > -1 && j > -1) {
    if (s1[i] == s2[j]) {
      suf[j] = i;
      j--;
    }
    i--;
  }
  start = j;
  int l = 1, r = len2;
  int ans = 0;
  int ans_pos;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (check(mid, ans_pos)) {
      l = mid + 1;
      ans = mid;
    } else
      r = mid - 1;
  }
  if (ans == 0) {
    printf("-\n");
    return 0;
  }
  for (int i = 0; i <= ans_pos; i++) printf("%c", s2[i]);
  for (int i = len2 + 1 + ans_pos - ans; i < len2; i++) printf("%c", s2[i]);
  printf("\n");
  return 0;
}
