07/06/28 14:40:31
>>427
#include <stdio.h>
#include <string.h>
void search(char *s1, char *s2)
{
int i;
char *p = s1;
while((p = strstr(p, s2)) != NULL){
*p++ = '#';
for(i = 0; i < strlen(s1) - 1; i++)
*(p + i) = *(p + i + strlen(s2) - 1);
}
}
int main(void)
{
char text[1024], word[1024];
printf("Please input text : ");
gets(text);
printf("text = %s\n", text);
printf("Please input search word : ");
gets(word);
search(text, word);
printf("text = %s\n", text);
return 0;
}