题目链接:All in All UVA - 10340
题意:
给两个字符串A 和 B。 如果在B中能找到非连续字串和A匹配输出 YES 不能输出NO。
思路:B一个个字母遍历过去每对应上A的一个字母就找A的下一个字母直到结束。。
ac代码:
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
#include<iomanip>
#define ll long long
using namespace std;
int n,m;
int main()
{
string s,t;
while(cin>>t>>s) {
int l1 = s.length();
int l2 = t.length();
int i = 0,j = 0;
for(;i < l1 && j < l2; i++)
if(s[i] == t[j]) j++;
if(j == l2) puts("Yes");
else puts("No");
}
return 0;
}