#include <stdio.h>
#include <string.h>
#include <stdbool.h>
void strlower(char*a){
int i=0;
for(i=0;a[i];i++){
if(a[i]>'A' && a[i]<'Z'){
a[i]+=32;
}
}
}
int main(void){
char str2[1000001],str1[11],*p,*q;
int i,j,cnt=0,ans1=-1;
bool flag=false;
gets(str1);
gets(str2);
strlower(str1);
strlower(str2);
p=str2;
int len=strlen(str1);
for(;;){
q=strstr(p,str1);
if(q!=NULL && (q==str1||*(q-1)==' ') && (*(q+len)=='\0'||*(q+len)==' ')){
cnt++;
if(flag==false){
flag=true;
ans1=q-str1;
}
p=q+len;
}
else{
break;
}
}
if(flag==true){
printf("%d %d",cnt,ans1);
}
else{
printf("%d",ans1);
}
return 0;
}
![为什么我的q找不到地址]()