#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const double sn = 1e-6;
char s1[100005], s2[100005];
int pr[100005], su[100005];
int main() {
  scanf("%s%s", s1, s2);
  int sz1 = strlen(s1), sz2 = strlen(s2);
  int j = 0;
  int ps, ss;
  int i;
  for (i = 0; i < sz2; i++) {
    while (true) {
      if (j == sz1 || s1[j] == s2[i]) break;
      j++;
    }
    if (j == sz1) break;
    pr[i] = j;
    j++;
  }
  j = sz1 - 1;
  ps = i;
  for (i = sz2 - 1; i >= 0; i--) {
    if (i == ps - 1) break;
    while (true) {
      if (j == -1 || s1[j] == s2[i]) break;
      j--;
    }
    if (j == -1) break;
    su[i] = j;
    j--;
  }
  ss = sz2 - 1 - i;
  int maxv = ss;
  j = i;
  int ip = -1, is = j + 1;
  if (maxv == 0) is = sz2;
  for (int i = 0; i < ps; i++) {
    while (pr[i] >= su[j]) {
      j++;
      if (j == sz2) {
        break;
      }
    }
    if (j == sz2) {
      if (ps > maxv) {
        maxv = ps;
        is = sz2;
        ip = ps - 1;
      }
      break;
    }
    if ((i + 1 + (sz2 - j)) > maxv) {
      maxv = i + 1 + (sz2 - j);
      is = j;
      ip = i;
    }
  }
  if (ip == -1 && is == sz2) {
    printf("-\n");
    return 0;
  }
  for (int i = 0; i <= ip; i++) printf("%c", s2[i]);
  for (int i = is; i < sz2; i++) printf("%c", s2[i]);
  printf("\n");
  return 0;
}
