/**
* 实验题目:
* 求一个串中出现的第一个最长重复字符串
* 实验目的:
* 掌握串的模式匹配应用算法设计
* 实验内容:
* 采用顺序结构存储串,采用简单模式匹配方法求串s中
* 出现的第一个最长重复子串的下标和长度
*/
#include <stdio.h>
#include <malloc.h>
#define MAX_SIZE 100
typedef struct
{
char data[MAX_SIZE]; // 串中字符
int length; // 串长
}SqString; // 声明顺序串类型
/*-----------------将字符串常量赋给串s--------------------*/
static void str_assign(SqString &s, char cstr[])
{
int i;
for(i = 0; cstr[i] != '\0'; i++)
s.data[i] = cstr[i];
s.length = i;
}
/*-----------------销毁串--------------------*/
static void destroy_str(SqString &s)
{
}
/*-----------------输出串s--------------------*/
static void disp_str(SqString s)
{
int i;