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.
/**
 * DA-IICT
 * Author : Savaliya Sagar
 */
import java.io.*;
import java.math.*;
import java.util.*;

public class C {

	public static int mod = 1000000007;
	public static FasterScanner in = new FasterScanner();
	public static PrintWriter o = new PrintWriter(System.out);

	public static void main(String[] args) {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					Solve();
					o.close();
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}, "1", 1 << 26).start();
	}

	public static void Solve() {
		String s1 = in.nextLine();
		String s2 = in.nextLine();
		int l1 = s1.length();
		int l2 = s2.length();
		int bl[] = new int[l2 + 1];
		int br[] = new int[l2 + 1];
		int t = 1;
		out: for (int i = 1; i <= l2; i++) {
			while (true) {
				if (t <= l1 && s1.charAt(t - 1) == s2.charAt(i - 1)) {
					bl[i] = t;
					t++;
					break;
				} else if (t > l1) {
					break out;
				} else {
					t++;
				}
			}
		}
		t = l1;
		out: for (int i = l2; i > 0; i--) {
			while (true) {
				if (t > 0 && s1.charAt(t - 1) == s2.charAt(i - 1)) {
					br[i] = t;
					t--;
					break;
				} else if (t <= 0) {
					break out;
				} else {
					t--;
				}
			}
		}
		int start = -1;
		int end = -1;
		int min = Integer.MAX_VALUE;
		int r = 0;
		int l = 0;
		while (r <= l2 && br[r] <= bl[l])
			r++;
		start = 0;
		end = r;
		min = r;
		for (int i = 1; i <= l2; i++) {
			if (bl[i] != 0) {
				while (r <= l2 && br[r] <= bl[i])
					r++;
				if (min > r - i) {
					min = r - i;
					start = i;
					end = r;
				}
			}
		}
//		debug(start,end);
		start--;
		end--;
		int flag = 0;
		for(int i=0;i<l2;i++){
			if(i<=start || i>=end){
				o.print(s2.charAt(i));
				flag = 1;
			}
		}
		if(flag==0){
			o.print("-");
		}
	}

	public static long gcd(long n1, long n2) {
		long r;
		while (n2 != 0) {
			r = n1 % n2;
			n1 = n2;
			n2 = r;
		}
		return n1;
	}

	public static long pow(long x, long n, long mod) {
		long res = 1;
		x %= mod;
		while (n > 0) {
			if (n % 2 == 1) {
				res = (res * x) % mod;
			}
			x = (x * x) % mod;
			n /= 2;
		}
		return res;
	}

	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static class FasterScanner {
		private byte[] buf = new byte[1024];
		private int curChar;
		private int snumChars;

		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = System.in.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 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 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 int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}

		public long[] nextLongArray(int n) {
			long a[] = new long[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextLong();
			}
			return a;
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
	}
}
