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<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
string s,t;
int f[3100][3100];
int main(){
	cin>>s>>t;
	for(int i=s.size();i>=0;i--){
		for(int j=t.size();j>=0;j--){
			if(s[i]==t[j]){
				f[i][j]=f[i+1][j+1]+1;
				continue;
			}
			f[i][j]=max(f[i][j+1],f[i+1][j]);
		}
	}
	int h=0,k=0;
	while(h<s.size()&&k<t.size()){
		if(s[h]==t[k]){
         printf("%c",s[h]);
         h++;
         k++;
         continue;
      }
		if(f[h][k]==f[h+1][k]){
         h++;
         continue;
      }
      k++;
	}
}