这一题只要从前到后扫描一遍就行了
#include<iostream>
#include<cstring>
#define max 100005
using namespace std;
char s1[max],s2[max];
int main()
{
while(cin>>s1>>s2)
{
int lengh1=strlen(s1);
int lengh2=strlen(s2);
int p=0;
int sum=0;
for(int i=0;i<lengh2;i++)
if ( s1[p] == s2[i] && p++ == lengh1-1 ) //这一步是学习的
break;
if(p==lengh1)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
return 0;
}