int main()
{
	    int S[maxn],T[maxn];
        int t,max1;
        int i,j;
        scanf("%d",&t);
        while(t--){
        	max1=0;
        	i=0;
        	scanf("%d",&S[0]);
        	while(S[i]!=0){
        	   	i++;
        		scanf("%d", &S[i]);
            }
        	while(1){
        		j=0;
        		scanf("%d",&T[0]);
        		if(T[0]!=0){
        			while(T[j]!=0){
        				j++;
        				scanf("%d",&T[j]);
					}
					 max1=max(LongestCommonSubsequence(S,T,i),max1);
			    }
				else
				   break;
			}
			printf("%d\n", max1);
	}
		return 0;
}
Exemple #2
0
int main()
{

    #ifndef ONLINE_JUDGE
        freopen("inp.txt", "r", stdin);
    #endif

        char S[maxn],T[maxn];/* S,T are two strings for which we have to find the longest common sub sequence. */
        scanf("%s%s",S,T); 
        printf("%d\n",LongestCommonSubsequence(S,T));
}