poj 3753(水题)
#include<iostream> #include<cstring> using namespace std; int main(){ char a[260],key[20],*p,old; int i; while(scanf("%s",a)==1){ while(scanf("%s",key)==1&&strcmp(key,"END")){ if(!strcmp(key,"NULL")){ printf("0 NULL\n"); } else{ p = strstr(a,key); if(p){ old = *p; *p = '\0'; if(p==a){ printf("0 NULL\n"); }else{ printf("%d %s\n",strlen(a),a); } *p = old; } else{ printf("%d %s\n",strlen(a),a); } } } } return 0; }

浙公网安备 33010602011771号