UVa10340 - All in All

//UVa10340 - All in All
//题目:判断s串是不是t串的子串。
//已AC
#include
#include
int main(){
    //freopen("data.in","r",stdin);
    char ch, s[100];
    while(scanf("%s",s) != EOF){
        scanf(" "); 
        int count=0; 
        //1.边读取边比较,往前推进
        while((ch=getchar())!='\n' && ch!=EOF) if(s[count]==ch) count++;
        //2.得到的正确字符个数
        if(count==(int)strlen(s)) printf("Yes\n");
        else printf("No\n");
        memset(s,0,sizeof(s));
    }
    return 0;
}

//输入样例:DI1=ge DI2=gweijie DO=YES   
//输入样例:DI1=ge DI2=weijie DO=NO

点赞

发表评论

昵称和uid可以选填一个,填邮箱必填(留言回复后将会发邮件给你)
tips:输入uid可以快速获得你的昵称和头像