【习题 3-9 UVA

【链接】 我是链接,点我呀:)
【题意】

在这里输入题意

【题解】

相当于让你判断s1是不是s2的子序列。 for一遍就好

【代码】

#include <bits/stdc++.h>
using namespace std;

string s1,s2;

int main(){
	#ifdef LOCAL_DEFINE
	    freopen("F:\c++source\rush_in.txt", "r", stdin);
	#endif
	while (cin >> s1 >> s2){
	 	int len1 = s1.size(),len2 = s2.size();
	 	int j = 0;
	 	for (int i = 0;i < len2 && j < len1;i++){
			if (s2[i]==s1[j]){
			 	j++;
	 	 	}
	 	}
	 	if (j < len1)
	 		puts("No");
	 	else
	 		puts("Yes");
	}
	return 0;
}
原文地址:https://www.cnblogs.com/AWCXV/p/7819420.html