题意 :给出两个字符串s、t,问s是不是t的子串(不用连续)。
——>>一个个扫描……感觉这次写得挺。。。
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s, t;
while(cin >> s >> t){
int len_s = s.length(), len_t = t.length(), i, j;
for(i = 0, j = 0; i < len_t; i++){
if(t[i] == s[j] && (++j) == len_s) break;
}
if(j == len_s) cout << "Yes" << endl;
else cout << "No" <<endl;
}
return 0;
}