CodePudding user response:
The building Lord logic design is too complicated, can be more refined, here a little modification, for reference:# include
#include
Char b [1000001], [1000001] d;//large arrays should be put in function in vitro
Int main ()
{
Char a [20], c [20].
Int n=0, I, j=0, m=0, s, x=0, k=0;
gets(a);
Gets (b);
for (i=0; A [I]!='\ 0'; I++) {
[I] c=tolower (a [I]);
}
[I] c='\ 0';//end
S=I;
for (i=0; B [I]!='\ 0'; I++) {
If (b [I]==' ') {
D=b [I] [I];
continue;
}
D=tolower [I] [I] (b);
}
for (i=0; D [I]!='\ 0'; I++) {
[I] if (d==' ') {k++; continue; }
If (x==1) {
If (d [I + 1)==' ') {
X=0;
//i++;
continue;
}
The else
continue;
}
If (d==c [j] [I]) {//if (d==c [I] [I]) {
J++;
X=0;
If (j> S) j=0;//to distinguish word length
}
The else
{
J=0;
x=1;
}
If (d==[I + 1] '| | d [I + 1)==' \ 0 ')
{
X=0;
If (j)==s {
n++;
If (n==1) m=k;//m=I - j + 1;
J=0;
//i++;
}
//else {
//i++;
//the continue;
//}
}
}
If (n==0) printf (" 1 ");
The else
Printf (" % d % d \ n ", n, m);
return 0;
}