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.
//package com.example;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.IntSummaryStatistics;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;


public class Main {


    public static void main(String[] args) throws IOException {

        InputStream cin = System.in;
        OutputStream cout = System.out;

        //InputStream fin = new FileInputStream("input.txt");
        //OutputStream fout = new FileOutputStream("output.txt");

        InputReader in = new InputReader(cin);
        PrintWriter out = new PrintWriter(cout);
        new TaskD().solve(in, out);
        //
        out.close();
    }

    static class TaskD {

        class Pair {
            int fs;
            int sc;
            int id;
            public Pair(int fs, int sc, int id) {
                this.fs = fs;
                this.sc = sc;
                this.id = id;
            }

            @Override
            public String toString() {
                return "(" + fs + " " + sc + ")";
            }
        }

        final int INF = -1;

        void solve(InputReader in, PrintWriter out) {
            //
            String a = in.next();
            String b = in.next();
            int n = a.length();
            int m = b.length();
            Integer pre[] = new Integer[m];
            Integer suf[] = new Integer[m];
            //
            int argl = - 1, argr = m, ans = 0;
            // PREFIX
            {
                int j = 0;
                for (int i = 0; i < m; i++) {
                    while (j < n && a.charAt(j) != b.charAt(i)) j++;
                    if (j != n) {
                        pre[i] = j;
                        j += 1;
                        argl = i;
                    } else {
                        pre[i] = INF;
                    }
                }
            }
            // SUFFIX
            {
                int j = n - 1;
                for (int i = m - 1; i >= 0; i--) {
                    while (j >= 0 && a.charAt(j) != b.charAt(i)) j--;
                    if (j != -1) {
                        suf[i] = j;
                        j -= 1;
                        argr = i;
                    } else {
                        suf[i] = INF;
                    }
                }
            }
            // ONLY PREFIX or ONLY SUFFIX, which one the best to take ???
            if (argl + 1 > m - argr) {
                ans = argl + 1;
                argr = -1;
            } else {
                ans = m - argr;
                argl = -1;
            }
            //
            for (int i = 0; i < m; i++) {
                if (pre[i] != INF) {
                    int q = Algorithms.binarySearch(Arrays.asList(suf), pre[i] + 1, i + 1, m - 1);
                    if (i + 1 + m - q > ans) {
                        argl = i;
                        argr = q;
                        ans = i + 1 + m - q;
                    }
                }
            }
            //
            //
            if (ans == 0) {
                out.println('-');
            } else {
                out.println(
                        (argl == -1 ? "" : new String(b.toCharArray(), 0, argl + 1)) +
                                (argr == -1 ? "" : new String(b.toCharArray(), argr, m - argr)));
            }
        }
    }
}

class SegmentTree {

    private int t[];
    private int size; // size of source array A
    private int NIL = 0x7FFFFFFF; // CONST to indicate unused value

    public SegmentTree(int a[]) {
        int sz = 1;
        while (sz < a.length) sz <<= 1;
        size = a.length;
        t = new int[2 * sz];
        t[1] = build(a, 1, 0, size - 1);
    }

    private int build(int a[], int id, int L, int R) {

        //
        if (L == R) {
            t[id] = a[L];
        } else {
            int mid = (L + R) >> 1;
            t[id] = build(a, id << 1, L, mid) + build(a, (id << 1) + 1, mid + 1, R);
        }
        return t[id];
    }

    public void update(int i, int diff) {
        update(1, 0, size - 1, i, diff);
    }

    private void update(int id, int L, int R, int i, int diff) {
        if (L == R) { // leaf node
            t[id] += diff;
        } else {
            int mid = (L + R) >> 1;
            if (i <= mid) {
                update(id << 1, L, mid, i, diff);
            } else {
                update((id << 1) + 1, mid + 1, R, i, diff);
            }
            t[id] = t[id << 1] + t[(id << 1) + 1];
        }
    }

    public int query(int i, int j) {
        return query(1, 0, size - 1, i, j);
    }

    private int query(int id, int L, int R, int i, int j) {
        if (i <= L && j >= R) {
            return t[id];
        } else {
            int mid = (L + R) >> 1;
            int ql = (mid >= i) ? query(id << 1, L, mid, i, j) : NIL;
            int qr = (mid + 1 <= j) ? query((id << 1) + 1, mid + 1, R, i, j) : NIL;
            return ql == NIL ? qr : qr == NIL ? ql : qr + ql;
        }
    }
}






final class Algorithms {

    public static <T extends Comparable<T>> int binarySearch(List<T> data, T key, int lhs, int rhs) {
        while (lhs <= rhs) {
            int m = (lhs + rhs) >> 1;
            if (key.compareTo(data.get(m)) > 0) { // key > data[m]
                lhs = m + 1;
            } else { // key <= data[m]
                rhs = m - 1;
            }
        }
        return lhs;
    }

    public static String printArray(Integer[] array) {
        StringBuilder answer = new StringBuilder();
        for (int i = 0; i < array.length; i++) {
            answer.append(array[i] + " ");
        }
        return answer.toString();
    }
}











class InputReader {
    //
    private StringTokenizer tokenizer;
    private BufferedReader reader;


    public InputReader(InputStream is) {
        reader = new BufferedReader(new InputStreamReader(is), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                String line = reader.readLine();
                if (line == null) return null;
                tokenizer = new StringTokenizer(line, " ");
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() { return Integer.parseInt(next()); }
    public long nextLong() { return Long.parseLong(next()); }

}


