题解 | BFS
BFS
https://www.nowcoder.com/practice/22da7730da5d4a129a188ba24d22f2bf
#include <stdio.h>
#include <ctype.h>
int main() {
char s[101];
scanf("%s\n", s);
int i=0;
int result=-1;
while(s[i]!='\0'&&s[i+1]!='\0'&&s[i+2]!='\0'){
char c1=tolower(s[i]);
char c2=tolower(s[i+1]);
char c3=tolower(s[i+2]);
if(c1=='b'&&c2=='o'&&c3=='b'){
result=i;
break;
}
i++;
}
printf("%d",result);
return 0;
}
