1. C语言如何实现KMP字符串匹配
#include <stdio.h>
#include <stdlib.h>
void KmpNextArray(const char* str, int len, int* next) {
/**/if (str == NULL || next == NULL || len <= 0) {
/**//**/return;
/**/}
/**/int n = 1;
/**/int i = 1;
/**/next[0] = 0;
/**/while (i < len && str[i] != str[0]) {
/**//**/next[i++] = 0;
/**/}
/**/if (i >= len) {
/**//**/return;
/**/}
/**/next[i++] = 1;
/**/for (; i < len; i++) {
/**//**/if (str[i] == str[n]) {
/**//**//**/next[i] = ++n;
/**//**/}
/**//**/else {
/**//**//**/next[i] = 0;
/**//**//**/n = 0;
/**//**/}
/**/}
}
int Strlen(const char* str) {
/**/if (str == NULL) {
/**//**/return 0;
/**/}
/**/int n = 0;
/**/while (str[n] != '