Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <iostream>#include <string.h>#include <stdio.h>using namespace std;#define N 10001#define M 1000001int next[N];char A[M];char B[N];void set_next(char *B) {next[0] = -1;int m = strlen(B);int j = -1;for(int i=1; i<m; i++) {while(j>=0 && B[j+1] != B[i]) {j = next[j];}if(B[j+1] == B[i])j = j+1;next[i] = j;}}int kmp(char *A, char *B) {int count = 0;int j = -1;int n = strlen(A);int m = strlen(B);