简单的字符串匹配 poj1936

来源:互联网 发布:数据采样 编辑:程序博客网 时间:2024/06/05 06:45
#include<iostream>#include<string>using namespace std;int main(){char s[100005],t[100005];int i,j,len1,len2;while(scanf("%s %s",s,t)!=EOF){ len1=strlen(s);len2=strlen(t);i=0;j=0;while(i<len1 && j<len2){if(s[i]==t[j]){i++;j++; }else{j++;}}if(i==len1)cout<<"Yes"<<endl;elsecout<<"No"<<endl;}return 0;}

原创粉丝点击