UVa10340 - All in All

//UVa10340 - All in All
//题目:判断s串是不是t串的子串。
//已AC
#include<stdio.h>
#include<string.h>
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

posted @ 2017-01-26 16:34  gwj1139177410  阅读(93)  评论(0编辑  收藏  举报
选择