// 串的模式匹配.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include
#include
using namespace std;
int Index(char S[],char T[],int pos)
{
//返回子串T在主串S中第pos个字符之后的位置.若不存在,则函数值为0
//其中,T非空,i<=pos<=StrLength(S).
int i=pos;
int j=1;
int m,n;
m=strlen(S);
n=strlen(T);
/* cout<
while(i<=m && j<=n){
if(S[i]==T[j]) {++i;++j;} //继续比较后续字符
else {i=i-j+2;j=1;} //指针后退重新开始匹配
}
/* cout<
if(j>n) return i-n;
else return 0;
}
int main(int argc, char* argv[])
{
//string CS,CT;
char CS[200],CT[100];
int pos;
cout<
scanf("%s",CS);
cout<
scanf("%s",CT);
pos=Index(CS,CT,1);
cout<
return 0;
}