题目大意:
输入两个字符串,如果字符串1包含在字符串2中(不必须是子串) 输出YES 否则输出 NO
没什么好说的 ,控制循环即可。
#include<iostream>
using namespace std;
char str1[100000],str2[100000];
int main(){
while(scanf("%s %s",&str1,&str2)!=EOF){
int i=0;
int j=0;
while(str1[i]!='\0'&&str2[j]!='\0'){
if(str1[i]==str2[j]){
i++;
j++;
}
else{
j++;
}
}
if(str1[i]=='\0') cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
}