int main()
{
int i,j,k,m,n,l,len;
char str[100],*p; //一定要开辟空间
cout<<"输入给定字符串。。。:"< gets(str);
len=strlen(str);
cout< puts(str);
int **a=new(int *[len]);
for(i=0;i a[i]=new int[len];
for(i=0;i for(j=0;j a[i][j]=0;
//abcdacdac
for(i=0;i {
for(j=i;j {
char *p=new char[len+1];
n=i;
for(k=0;k {
p[k]=str[n];
n++;
}
p[k]=0;
//cout << p << endl ;
for(m=0;m {
if( !strncmp(&str[m], p , strlen(p)) )
a[i][j]++;
}
cout << p << ": occur: " << a[i][j] < delete []p;
}
}
for( n=0;n delete[]a[n];
delete []a;
system("pause");
return 0;
}
阅读(850) | 评论(0) | 转发(0) |