POJ-1936 All in All---字符串水题

时间:2024-09-03 17:06:56

题目链接:

https://vjudge.net/problem/POJ-1936

题目大意:

给两个字符串,判断是s1是不是s2的子序列

思路:

 #include<iostream>
#include<string>
#include<vector>
#include<cstring>
using namespace std;
int main()
{
string s1, s2;
while(cin >> s1 >> s2)
{
int i = , j = , tot = ;
for(; i < s1.size() && j < s2.size();)
{
if(s1[i] == s2[j])
{
tot++;
i++;
j++;
}
else j++;
}
if(tot == s1.size())cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
return ;
}