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;
}

 

posted @ 2021-12-05 20:10  智人心  阅读(22)  评论(0)    收藏  举报