int bf(str s)
{
int i = 0, j = 0, index = 0;
while (arr[i] != '\0' && s.arr[j]!='\0')
{
if (arr[i] == s.arr[j])
{
i++;
j++;
}
else
{
index++;
i = index;
j = 0;
}
}
if (s.arr[j] == '\n')
{
return index;
}
return index;
}
本算法的类在上一篇文章