#include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
#define CHUNKSIZE 100
#define N 100
#define OK 1
#define ERROR 0
#define OVERFLOW -2//(1)创建一个串;(2)实现BF模式匹配算法;(3)实现KMP模式匹配算法;(4)调用创建串函数创建主串和模式串;(5)调用BF算法输出匹配结果;(6)调用KMP算法输出匹配结果;
typedef char ElemType;
typedef int Status;
typedef struct {
char *ch;//若是非空串,则按串长分配存储区,否则ch 为NULL;
int length;//串的当前长度
}HString;
//初始化
Status InitHString(HString &S)//
{
S.ch = new ElemType[CHUNKSIZE];//为串分配一个数组空间
if (!S.ch)exit(OVERFLOW);//存储分配失败
// s.ch[1]="\0"或者#;//表示字符串结束标志
S.length = 0;//初始长度为0
return OK;
} //创建串
Status CreateHString(HString &S, int le