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.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.List;
 import java.util.*;
 public class realfast implements Runnable 
  {
    private static final int INF = (int) 1e9;
    long in= 998244353;
    long fac[]= new long[3000];
    public  void solve() throws IOException 
    {
      String a = readString();
      String b = readString();
      int s[]= new int[a.length()+1];
      int e[]= new int[a.length()+1];
      int j =0;
    
      for(int i =0;i<a.length();i++){
        if(j<b.length()&&a.charAt(i)==b.charAt(j))
        {
            j++;
            s[i]=j;
        }
        else
            s[i]=j;
        }
        j=b.length()-1;
        int lo=0;
       for(int i =a.length()-1;i>=0;i--){
        if(j>=0&&a.charAt(i)==b.charAt(j))
        {

            j--;
            lo++;
            e[i]=lo;
        }
        else
            e[i]=lo;
        }
        int n= a.length();
        
        int left=-1;
        int right =-1;
        int len =0;
        for(int i=0;i<a.length()-1;i++)
        {
            int c = s[i]+e[i+1];
            
            if(len<c)
            {
                len=c;
                 left=s[i];
                 right= e[i+1];
            }
        }
        if(e[0]>len)
        {
            len=e[0];
            left=0;
            right=e[0];
        }
        if(s[a.length()-1]>len)
        {
            len =s[a.length()-1];
            left =len;
            right=0;
        }
       // out.println(left+" "+right);
        if(len==0)
            out.println("-");
        else
        {
            if(len<b.length())
            {
             for(int i=0;i<left;i++)
                out.print(b.charAt(i));
           //  out.println();
             for(int i=right;i>=1;i--)
                out.print(b.charAt(b.length()-i));
            }
            else
            {
               out.println(b);
            }

        }



    }

    public int build(int seg[] , int left, int right , int index , int sum[])
    {
             if(left==right)
             {
                seg[index]= sum[left];
                return seg[index];
             }
             int mid = left +(right-left)/2;
             int left1 = build(seg, left,mid,2*index+1,sum);
             int right1 = build(seg,mid+1,right, 2*index+2,sum);
             seg[index]=Math.max(left1,right1);
             return seg[index];
    }
    public int value (int seg[], int left , int right ,int index, int l, int r)
    {
            
            if(left>right)
            {
              return -100000000;
            }
            if(right<l||left>r)
                return -100000000;
            if(left>=l&&right<=r)
                return seg[index];
            int mid = left+(right-left)/2;
            int val = value(seg,left,mid,2*index+1,l,r);
            int val2 = value(seg,mid+1,right,2*index+2,l,r);
            return Math.max(val,val2);

    }
   
    public int gcd(int a , int b )
    {
      if(a<b)
      {
        int t =a;
        a=b;
        b=t;
      }
      if(a%b==0)
        return b ;
      return gcd(b,a%b);
    }
    public long pow(long n , long p,long m)
    {
         if(p==0)
            return 1;
        long val = pow(n,p/2,m);;
        val= (val*val)%m;
        if(p%2==0)
            return val;
        else
            return (val*n)%m;
    }
    
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public static void main(String[] args) {
        new Thread(null, new realfast(), "", 128 * (1L << 20)).start();
    }
 
    private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    private BufferedReader reader;
    private StringTokenizer tokenizer;
    private PrintWriter out;
 
    @Override
    public void run() {
        try {
            if (ONLINE_JUDGE || !new File("input.txt").exists()) {
                reader = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            } else {
                reader = new BufferedReader(new FileReader("input.txt"));
                out = new PrintWriter("output.txt");
            }
            solve();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            try {
                reader.close();
            } catch (IOException e) {
                // nothing
            }
            out.close();
        }
    }
 
    private String readString() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
 
    @SuppressWarnings("unused")
    private int readInt() throws IOException {
        return Integer.parseInt(readString());
    }
 
    @SuppressWarnings("unused")
    private long readLong() throws IOException {
        return Long.parseLong(readString());
    }
 
    @SuppressWarnings("unused")
    private double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }
}
class edge implements Comparable<edge>{
    int val ;
    int color;
    
    edge(int u, int v)
    {
       this.val=u;
       this.color=v;
    }
    public int compareTo(edge e)
    {
        return this.val-e.val;
    }
}