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.
import java.util.*;
import java.io.*;
public class MainClass
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        char[] S = in.readLine().toCharArray();
        String s1 = in.readLine();
        char[] T = s1.toCharArray();
        int n = S.length;
        int m = T.length;
        int i = 0;
        int j = 0;
        int[] left = new int[m];
        int[] right = new int[m];
        Arrays.fill(left, n);
        Arrays.fill(right, -1);
        while (i < n && j < m)
        {
            if (S[i] == T[j])
            {
                left[j] = i;
                i++;
                j++;
            }
            else
                i++;
        }
        i = n - 1;
        j = m - 1;
        while (i >= 0 && j >= 0)
        {
            if (S[i] == T[j])
            {
                right[j] = i;
                j--;
                i--;
            }
            else
                i--;
        }
        int[] leftEager = new int[n];
        int[] rightEager = new int[n];
        Arrays.fill(leftEager, -1);
        Arrays.fill(rightEager, m);
        for (int k=0;k<m;k++)
        {
            if (left[k] < n)
                leftEager[left[k]] = k;
        }
        for (int k=0;k<m;k++)
        {
            if (right[k] >= 0)
                rightEager[right[k]] = k;
        }
        for (int k=1;k<n;k++)
            leftEager[k] = Math.max(leftEager[k - 1], leftEager[k]);
        for (int k=n - 2;k>=0;k--)
            rightEager[k] = Math.min(rightEager[k + 1], rightEager[k]);
        int min = m;
        int startIndex = 0;
        for (int k=0;k<n - 1;k++)
        {
            int m1 = leftEager[k] + 1;
            int m2 = rightEager[k + 1] - 1;
            int len = Math.max(m2 - m1 + 1, 0);
            if (len < min)
            {
                min = len;
                startIndex = m1;
            }
        }
        if (min == 0)
        {
            System.out.println(s1);
            System.exit(0);
        }
        int m1 = rightEager[0];
        if (m1 < min)
        {
            min = m1;
            startIndex = 0;
        }
        int m2 = m - leftEager[n - 1] - 1;
        if (m2 < min)
        {
            min = m2;
            startIndex = leftEager[n - 1] + 1;
        }
        if (min == m)
            System.out.println("-");
        else
        {
            System.out.println(s1.substring(0, startIndex) + s1.substring(startIndex + min));
        }
    }
}
class Reader
{
    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;

    public Reader()
    {
        din = new DataInputStream(System.in);
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public Reader(String file_name) throws IOException
    {
        din = new DataInputStream(new FileInputStream(file_name));
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public String readLine() throws IOException
    {
        byte[] buf = new byte[64]; // line length
        int cnt = 0, c;
        while ((c = read()) != -1)
        {
            if (c == '\n')
                break;
            buf[cnt++] = (byte) c;
        }
        return new String(buf, 0, cnt);
    }

    public int nextInt() throws IOException
    {
        int ret = 0;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();
        do
        {
            ret = ret * 10 + c - '0';
        }  while ((c = read()) >= '0' && c <= '9');

        if (neg)
            return -ret;
        return ret;
    }

    public long nextLong() throws IOException
    {
        long ret = 0;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();
        do {
            ret = ret * 10 + c - '0';
        }
        while ((c = read()) >= '0' && c <= '9');
        if (neg)
            return -ret;
        return ret;
    }

    public double nextDouble() throws IOException
    {
        double ret = 0, div = 1;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();

        do {
            ret = ret * 10 + c - '0';
        }
        while ((c = read()) >= '0' && c <= '9');

        if (c == '.')
        {
            while ((c = read()) >= '0' && c <= '9')
            {
                ret += (c - '0') / (div *= 10);
            }
        }

        if (neg)
            return -ret;
        return ret;
    }

    private void fillBuffer() throws IOException
    {
        bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
        if (bytesRead == -1)
            buffer[0] = -1;
    }

    private byte read() throws IOException
    {
        if (bufferPointer == bytesRead)
            fillBuffer();
        return buffer[bufferPointer++];
    }

    public void close() throws IOException
    {
        if (din == null)
            return;
        din.close();
    }
}