- 129 名前:デフォルトの名無しさん mailto:sage [2007/07/16(月) 23:28:59 ]
- >>120 便乗
#include <stdio.h> #include <string.h> int main(void) { char buf[1024], rep[2048], word1[32], word2[32], *p = buf, *q = rep; scanf("%[^\n]%s%s", buf, word1, word2); while(*p){ if(!strncmp(p, word1, strlen(word1))) strcpy(q, word2), p += strlen(word1), q += strlen(word2); else *q++ = *p++; } *q = '\0'; puts(rep); return 0; }
|

|