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.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;
/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
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) {
            String a = in.next();
            String b = in.next();
            int[] fl = new int[b.length() + 1];
            Arrays.fill(fl, a.length()); // this is impossible as clearly we can't use a[a.length]
            fl[0] = -1;
            int aPtr = 0;
            for (int i = 1; i <= b.length(); i++) {
                char bc = b.charAt(i - 1);
                while (aPtr < a.length() && a.charAt(aPtr) != bc) aPtr++;
                if (aPtr >= a.length()) break;
                fl[i] = aPtr++;
            }
            int[] fr = new int[b.length() + 1];
            Arrays.fill(fr, -1);
            fr[b.length()] = a.length();
            aPtr = a.length() - 1;
            for (int i = b.length() - 1; i >= 0; i--) {
                char bc = b.charAt(i);
                while (aPtr >= 0 && a.charAt(aPtr) != bc) aPtr--;
                if (aPtr < 0) break;
                fr[i] = aPtr--;
            }
            int reslength = 0, reslastleft = -1, resfirstright = -1;
            for (int lastleft = -1; lastleft < b.length(); lastleft++) {
                int leftused = fl[lastleft + 1];
                if (leftused >= a.length()) continue;
                int firstrightL = lastleft + 1, firstrightR = b.length();
                while (firstrightL < firstrightR) {
                    int firstrightM = (firstrightL + firstrightR) / 2;
                    if (leftused < fr[firstrightM]) firstrightR = firstrightM;
                    else firstrightL = firstrightM + 1;
                }
                if (!(leftused < fr[firstrightL])) throw new RuntimeException();
                int leftchars = lastleft + 1;
                int rightchars = b.length() - firstrightL;
                int len = leftchars + rightchars;
                if (len > reslength) {
                    reslength = len;
                    reslastleft = lastleft;
                    resfirstright = firstrightL;
                }
            }
            if (reslength == 0) out.printLine("-");
            else out.printLine(b.substring(0, reslastleft + 1) + b.substring(resfirstright));
        }
    }
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;
        public InputReader(InputStream stream) {
            this.stream = stream;
        }
        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }
        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }
        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }
        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
        public String next() {
            return readString();
        }
        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    static class OutputWriter {
        private final PrintWriter writer;
        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }
        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }
        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }
        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }
        public void close() {
            writer.close();
        }
    }
}

