您的位置:首页 > 其它

习题3-9 子序列(All in All, UVa 10340)

2017-11-24 16:16 453 查看
#include <iostream>
#include <string>
#include <cstring>
#define mem(x) memset(x,0,sizeof(x))
using namespace std;

int main()
{
string s1,s2;
while(cin>>s1>>s2)
{
int l1=s1.length(),l2=s2.length();
int i=0,j=0;
while(i<l1&&j<l2)
{
if(s1[i]==s2[j])
{
i++;
}
j++;
}
if(i==l1)
{
cout<<"Yes"<<endl;
}
else cout<<"No"<<endl;
}

return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: