Problem: You are given strings s and t. Find one longest string that is a subsequence of both s and t.

Constraints

* s and t are strings consisting of lowercase English letters.
* 1 \leq |s|, |t| \leq 3000

Input

Input is given from Standard Input in the following format:


s
t


Output

Print one longest string that is a subsequence of both s and t. If there are multiple such strings, any of them will be accepted.

Examples

Input

axyb
abyxb


Output

axb


Input

aa
xayaz


Output

aa


Input

a
z


Output




Input

abracadabra
avadakedavra


Output

aaadara

Solution (in CPP):

Solution:
#include<iostream>
using namespace std;
string ar[2][3050];
string a,b;
string bg(string l,string r){
	if (l.size()>r.size()) return l;
	return r;
}
int main(){
	cin>>a>>b;
	for(int i=1;i<=a.size();i++){
		for(int j=1;j<=b.size();j++){
			ar[i%2][j]=bg(ar[(i-1)%2][j],ar[i%2][j-1]);
			if(a[i-1]==b[j-1])
			ar[i%2][j]=bg(ar[i%2][j],ar[(i-1)%2][j-1]+a[i-1]);
		}
	}
	cout<<ar[a.size()%2][b.size()];
}