南阳理工ACM 公共子序列

#include "stdio.h"
#include "string.h"
int main()
{
    char a[1010],b[1010];               //a为子串,b为母串
	int N;
	scanf("%d",&N);
	while(N)
	{
	scanf("%s%s",a,b);
	int x,y,count=0;
	int j=0;
	x=strlen(a);
	y=strlen(b);
	for(int i=0;i<x;i++)
		for(;j<y;j++)
			if(a[i]==b[j])
			{
				count++;
				break;
			}
			printf("%d
",count);
	}
	return 0;
}


原文地址:https://www.cnblogs.com/dengshiwei/p/3971466.html