您的位置:首页 > 其它

All in All

2016-02-03 20:25 288 查看
题意:

判断给出的序列是不是后一个的子序列

思路:

逐位比较

代码:

#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
using namespace std;
string a, b;
int main() {
while(cin>>a>>b) {
int asize = a.size();
int bsize = b.size();
if(asize > bsize) {
printf("No\n");
continue;
}
int j=0;
for(int i=0; i<bsize; i++){
if(a[j] == b[i]) j++;
}
if(j == asize) printf("Yes\n");
else printf("No\n");
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: