#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 7;   int l[N], r[N], n, len, posl, posr;   char a[N], b[N];   int ans, ans1, ans2;   vector<int> vec[30];   int main() {     for (int i = 0; i < 30; ++i) vec[i].push_back(1);     scanf( %s%s , a + 1, b + 1);     n = strlen(a + 1);     len = strlen(b + 1);     for (int i = 1; i <= n; ++i) vec[a[i] -  a ].push_back(i);     for (int i = 1; i <= len; ++i) {       int c = b[i] -  a ;       int& pos = vec[c][0];       while (pos <= vec[c].size() - 1 && vec[c][pos] <= l[i - 1]) {         pos++;       }       if (pos > vec[c].size() - 1)         l[i] = n + 1;       else         l[i] = vec[c][pos++];     }     for (int i = 0; i < 30; ++i) vec[i][0] = vec[i].size() - 1;     r[len + 1] = n + 1;     for (int i = len; i >= 1; --i) {       int c = b[i] -  a ;       int& pos = vec[c][0];       while (pos && vec[c][pos] > r[i + 1]) {         pos--;       }       if (pos == 0)         r[i] = 0;       else         r[i] = vec[c][pos--];     }     for (int i = 1; i <= len; ++i)       if (l[i] > l[i - 1] && l[i] <= n)         posl = i;       else         break;     posr = len + 1;     for (int i = len; i >= 1; --i)       if (r[i] < r[i + 1] && r[i] != 0)         posr = i;       else         break;     if (ans < posl) {       ans = posl;       ans1 = posl;       ans2 = len + 1;     }     if (ans < len - posr + 1) {       ans = len - posr + 1;       ans1 = 0;       ans2 = posr;     }     for (int i = posr; i <= len; ++i) {       int tmp = r[i];       int pos = lower_bound(l + 1, l + posl + 1, tmp) - l;       pos--;       if (pos >= i) pos = i - 1;       int val = len - i + 1 + pos;       if (ans < val) {         ans = val;         ans1 = pos;         ans2 = i;       }     }     if (ans == 0)       puts( - );     else {       for (int i = 1; i <= ans1; ++i) putchar(b[i]);       for (int i = ans2; i <= len; ++i) putchar(b[i]);       puts(  );     }     return 0;   }   