POJ-1936 All in All
题目链接:POJ-1936
题目大意:问前面的字符串是否按顺序存在于后面的字符串中
解题思路:双指针做法 十足的水题
代码块:
#include<iostream>
#include<string>
using namespace std;
int main(){
string strA, strB;
while(cin>>strA>>strB){
int lenA = strA.length();
int lenB = strB.length();
int i = 0, j = 0;
while(i < lenA && j < lenB){
if(strA[i] == strB[j]){
i++;
}
j++;
}
if(i == lenA) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
return 0;
}