# include
# include
Int main () {
Int q=0, I, j, k, l, first;
Char a [1000000], [11] b;
The scanf (" % s ", b);
getchar();
Gets (a);
K=strlen (a);
L=strlen (b);
for(i=0; i
j--;//here to rule out a situation: the last character range equal end cycle or break out of the value of j, added a j - so, anyway j behind nor
break;
}
}
If (j==l - 1) {
If (q==0)//record for the first time the location of the
The first=I;
Q++;
}
}
If (q==0)
Printf (" 1 ");
The else {
Printf (" % d % d ", q, first);
}
return 0;
}
CodePudding user response:
# include
# include
#include
Void str_to_lower (char * STR)
{
int i=0;
While (STR) [I] {
If (isupper (STR [I]))
STR=STR [I] [I] + 32;
i++;
}
}
Int main ()
{
The static char STR [100000].
Char substr [16].
Int I, j, k;
Int first=1, CNT=0;
The fgets (STR, sizeof (STR), stdin);
The scanf (" % s ", substr);
Str_to_lower (STR);
Str_to_lower substr ();
i=0;
While (STR) [I] {
For (j=0; Substr [j] & amp; & STR (I + j), J++) {
If (substr [j].=STR [I + j])
break;
}
Printf (" I=% d \ n ", I);
If (substr [j]=='\ 0') {
If (first==1)
The first=I;
cnt++;
}
If (j!=0)
I +=j;
The else
i++;
}
If (first==1)
Printf (" 1 ");
The else
Printf (" % d % d ", CNT, first);
/*
Int q=0, I, j, k, l, first;
Char a [1000000], [11] b;
The scanf (" % s ", b);
getchar();
Gets (a);
K=strlen (a);
L=strlen (b);
for(i=0; ifor(j=0; J If ((a [I + j]! [j])=b & amp; & (a/I + j!=b [j] + 32 | | a [I + j]!=[j] - 32 b)) {//case regardless of
j--;//here to rule out a situation: the last character range equal end cycle or break out of the value of j, added a j - so, anyway j behind nor
break;
}
}
If (j==l - 1) {
If (q==0)//record for the first time the location of the
The first=I;
Q++;
}
}
If (q==0)
Printf (" 1 ");
The else {
Printf (" % d % d ", q, first);
}
*/
return 0;
}
For your reference ~