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.*;
import java.util.*;
 
public class Main {
	static int t,n,m,k,mod=998244353,maxn=300005;
    static long INF=(long)1e16;
    
    static int l,r;
    static int[] pref,suf;
    
    void solve(PrintWriter out, Reader in) throws IOException{
        String a = in.next();
        String b = in.next();
        
        pref = new int[b.length()];
        suf = new int[b.length()];
        l = 0;
        for(int i=0;i<b.length();i++){
            pref[i] = -1;
            
            if(l==a.length()) continue;
            if(b.charAt(i)==a.charAt(l)){
                pref[i] = l;
            }else{
                i--;
            }
            l++;
        }
        l=a.length()-1;
        for(int i=b.length()-1;i>=0;i--){
            suf[i] = -1;
            
            if(l==-1) continue;
            if(b.charAt(i)==a.charAt(l)){
                suf[i] = l;
            }else{
                i++;
            }
            l--;
        }
        
        int lo=0,hi=b.length()-1,mid=0,res=b.length();
        while(lo<=hi){
            mid = (lo+hi)/2;
            
            if(check(mid,b.length())){
                res = mid;
                hi = mid-1;
            }else lo = mid+1;
        }
        
        if(res==b.length()) out.println('-');
        else out.println(b.substring(0,l)+b.substring(r));
    }
    
    static boolean check(int x,int len){
        for(int i=0;i<len-x+1;i++){
            if(i==0 && suf[i+x]!=-1) {
                l=0;r=i+x;
                return true;
            }
            if(i==len-x && pref[i-1]!=-1) {
                l=i;r=i+x;
                return true;
            }
            if(i==0 || i==len-x) continue;
            if(pref[i-1]<suf[i+x] && pref[i-1]!=-1 && suf[i+x]!=1) {
                l=i;r=i+x;
                return true;
            }
        }
        
        return false;
    }
    
    static class Reader {
 
    private InputStream mIs;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
 
    public Reader() {
        this(System.in);
    }
 
    public Reader(InputStream is) {
        mIs = is;
    }
 
    public int read() {
        if (numChars == -1) {
            throw new InputMismatchException();
 
    }
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = mIs.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0) {
                return -1;
            }
        }
        return buf[curChar++];
    }
 
    public String nextLine() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndOfLine(c));
        return res.toString();
    }
 
    public String next() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }
 
    double nextDouble()
    {
        return Double.parseDouble(next());
    }
 
    public long nextLong() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }
 
    public int nextInt() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }
 
    public boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }
 
    public boolean isEndOfLine(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }
 
    }
    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(System.out);
        Reader in = new Reader();
        Main solver = new Main();
        solver.solve(out, in);
        out.flush();
        out.close();
 
    }
}