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.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.util.NoSuchElementException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Ruins He
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            char[] string = in.nextChars();
            char[] pattern = in.nextChars();
            int n = string.length, m = pattern.length;
            int[] prefix = new int[n];
            int[] suffix = new int[n];

            for (int i = 0, j = -1; i < n; i++) {
                if (j + 1 < m && string[i] == pattern[j + 1]) {
                    j++;
                }
                prefix[i] = j;

                if (j == m - 1) {
                    out.println(new String(pattern));
                    return;
                }
            }

            for (int i = n - 1, j = m; i >= 0; i--) {
                if (j - 1 >= 0 && string[i] == pattern[j - 1]) {
                    j--;
                }
                suffix[i] = j;
            }

            int minimum = m + 1, start = 0;

            for (int i = -1; i < n; i++) {
                int from = i == -1 ? 0 : prefix[i] + 1;
                int to = i + 1 == n ? m - 1 : suffix[i + 1] - 1;

                if (from <= to && minimum > to - from + 1) {
                    minimum = to - from + 1;
                    start = from;
                }
            }

            if (minimum == m) {
                out.println("-");
            } else {
                StringBuilder builder = new StringBuilder();
                if (start > 0) {
                    builder.append(pattern, 0, start);
                }
                if (start + minimum < m) {
                    builder.append(new String(pattern).substring(start + minimum));
                }
                out.println(builder.toString());
            }
        }

    }

    static class InputReader {
        public final BufferedReader reader;
        public StringTokenizer tokenizer = null;

        public InputReader(Reader reader) {
            this.reader = new BufferedReader(reader, 32767);
        }

        public InputReader(InputStream inputStream) {
            this(new InputStreamReader(inputStream));
        }

        public String next() {
            if (hasNext()) return tokenizer.nextToken();
            else throw new NoSuchElementException();
        }

        public char[] nextChars() {
            return next().toCharArray();
        }

        public boolean hasNext() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    String nextLine = reader.readLine();
                    if (nextLine == null) return false;
                    tokenizer = new StringTokenizer(nextLine);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.hasMoreTokens();
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        private OutputWriter(Writer writer, boolean autoFlush) {
            this.writer = new PrintWriter(new BufferedWriter(writer, 32767), autoFlush);
        }

        public OutputWriter(Writer writer) {
            this(writer, true);
        }

        public OutputWriter(OutputStream outputStream) {
            this(new OutputStreamWriter(outputStream), false);
        }

        public OutputWriter println(String string) {
            writer.println(string);
            return this;
        }

        public void close() {
            writer.close();
        }

    }
}

