POJ-1936 All in All---字符串水题
题目链接:
https://vjudge.net/problem/POJ-1936
题目大意:
给两个字符串,判断是s1是不是s2的子序列
思路:
水
1 #include<iostream> 2 #include<string> 3 #include<vector> 4 #include<cstring> 5 using namespace std; 6 int main() 7 { 8 string s1, s2; 9 while(cin >> s1 >> s2) 10 { 11 int i = 0, j = 0, tot = 0; 12 for(; i < s1.size() && j < s2.size();) 13 { 14 if(s1[i] == s2[j]) 15 { 16 tot++; 17 i++; 18 j++; 19 } 20 else j++; 21 } 22 if(tot == s1.size())cout<<"Yes"<<endl; 23 else cout<<"No"<<endl; 24 } 25 return 0; 26 }
越努力,越幸运