将一串很长的字符串中的baidu改成一个更长的单词
1 #include<stdio.h> 2 #include<string.h> 3 #define maxn 100000 4 int main() 5 { 6 long int len,i,num=0; 7 int k,j; 8 char s[maxn]; 9 gets(s); 10 len=strlen(s); 11 for(i=0;i<len;i++) 12 { 13 if(s[i]=='b'&&s[i+1]=='a'&&s[i+2]=='i'&&s[i+3]=='d'&&s[i+4]=='u') 14 { 15 num++; 16 s[i]='g'; 17 s[i+1]='o'; 18 s[i+2]='o'; 19 s[i+3]='d'; 20 s[i+4]=s[i+5]; 21 i=i+4; 22 23 } 24 25 } 26 s[i]='