You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
for (int i = 0, j = -1; i < len; i++)
|
|
{
|
|
while (~j && t[j + 1] != s[i]) j = next[j];
|
|
if (t[j + 1] == s[i]) j++;
|
|
if (j == len - 1) ans++, j = next[j];
|
|
} |