1 /* 2 状态转移方程如下 ai,bj分别代表a字符串和b字符串的i,j处的字符 3 4 -> 0 (i = j =0) 5 v[i,j] = -> v[i-1][j-1] (ai == bj) 6 -> Max(v[i-1][j],v[i][j-1]) (ai != bj) 7 */ 8 #include<cstdio> 9 #include<cstring> 10 #define Max(a,b) ((a)>(b)?(a):(b)) 11 using namespace std; 12 13 char a[1005],b[1005]; 14 int v[1005][1005]; 15 int n,i,j; 16 17 int main() 18 { 19 int n; 20 scanf("%d",&n); 21 while(n--) 22 { 23 scanf("%s%s",a,b); 24 for(i=0; a[i]!='