for (int i=1; i<=n1; i++) for (int j=1; j<=n2; j++) if (s1[i] == s2[j]) length[i][j] = length[i-1][j-1] + 1; else