您的位置:首页 > 其它

UVA - 10340 All in All

2014-10-30 22:41 429 查看
题目大意:判断一个字符串的所有字符是否都在另一个字符串里面

解题思路:水题
#include<cstdio>
#include<cstring>
char s[100000],t[100000];
int main() {
	while(scanf("%s %s",s,t) != EOF) {
		int len1 = strlen(s);
		int len2 = strlen(t);
		int count = 0;	
		for(int i = 0; i < len2; i++) {
			if(t[i] == s[count])
				count++;
			if(len1 - count > len2 -i)		
				break;				
		}

		if(count == len1) 
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: