void pre()
{
p[1] = 0;
int j = 0;
for (int i = 1; i < m; ++i)
{
while (j>0 && b[j+1]!=b[i+1]) j = p[j];
if (b[j+1] == b[i+1]) ++j;
p[i+1] = j;
}
}
int kmp()
{
int ans = 0, j = 0;
for (int i = 0; i < n; ++i)
{
while (j>0 &&b[j+1] != a[i+1]) j = p[j];
if (b[j+1] == a[i+1]) ++j;
if (j == m)
{
++ ans;
j = 0;
}
}
return ans;
}