You are given two strings a and b. You have to remove the minimum possible number of consecutive (standing one after another) characters from string b in such a way that it becomes a subsequence of string a. It can happen that you will not need to remove any characters at all, or maybe you will have to remove all of the characters from b and make it empty.

Subsequence of string s is any such string that can be obtained by erasing zero or more characters (not necessarily consecutive) from string s.

Input

The first line contains string a, and the second line — string b. Both of these strings are nonempty and consist of lowercase letters of English alphabet. The length of each string is no bigger than 105 characters.

Output

On the first line output a subsequence of string a, obtained from b by erasing the minimum number of consecutive characters.

If the answer consists of zero characters, output «-» (a minus sign).

Examples

Input

hi
bob


Output

-


Input

abca
accepted


Output

ac


Input

abacaba
abcdcba


Output

abcba

Note

In the first example strings a and b don't share any symbols, so the longest string that you can get is empty.

In the second example ac is a subsequence of a, and at the same time you can obtain it by erasing consecutive symbols cepted from string b.
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int n, m;
  string s, t;
  cin >> s;
  cin >> t;
  swap(s, t);
  n = s.size();
  m = t.size();
  int dp1[m];
  if (s[0] == t[0])
    dp1[0] = 1;
  else
    dp1[0] = 0;
  for (int i = 1; i < m; i++)
    if (dp1[i - 1] < n) {
      dp1[i] = dp1[i - 1];
      if (s[dp1[i - 1]] == t[i]) dp1[i]++;
    } else
      dp1[i] = dp1[i - 1];
  int dp2[m + 1];
  reverse(s.begin(), s.end());
  reverse(t.begin(), t.end());
  if (s[0] == t[0])
    dp2[0] = 1;
  else
    dp2[0] = 0;
  for (int i = 1; i < m; i++)
    if (dp2[i - 1] < n) {
      dp2[i] = dp2[i - 1];
      if (s[dp2[i - 1]] == t[i]) dp2[i]++;
    } else
      dp2[i] = dp2[i - 1];
  int mx = 0, p = 0, ll = 0, rr = 0;
  for (int i = -1; i < m; i++) {
    int x = mx;
    int l, r;
    if (i < 0) {
      l = 0;
      r = dp2[m - 1];
      mx = max(mx, dp2[m - 1]);
    } else if (m - i - 2 < 0) {
      l = dp1[i];
      r = 0;
      mx = max(mx, dp1[i]);
    } else {
      mx = max(mx, dp1[i] + dp2[m - i - 2]);
      l = dp1[i];
      r = dp2[m - i - 2];
    }
    if (mx > x) {
      ll = l;
      rr = r;
      p = i;
    }
  }
  string ans = "";
  reverse(s.begin(), s.end());
  for (int i = 0; i < ll; i++) ans += s[i];
  reverse(s.begin(), s.end());
  for (int i = rr - 1; i >= 0; i--) ans += s[i];
  reverse(s.begin(), s.end());
  if (s.size() < ans.size()) ans = s;
  if (ans.size() == 0) ans = '-';
  cout << ans << "\n";
}
