poj 1936

题意:给定两个字符串 判断是否在第二个字符串中存在子串(可以不连续)为第一个穿

大水体

#include<iostream>
using namespace std;
char s[100001],t[100001];
int main()
{
    int ls,le;
    int ts,te;
    int l1,l2;
    while(scanf("%s%s",s,t)!=EOF)
    {
        l1=strlen(s);
        l2=strlen(t);
        if(l2<l1)
        {
            printf("No
");
            continue;
        }
        ls=0;le=l1-1;
        ts=0;te=l2-1;
        while(ts<=te)
        {
            if(s[ls]==t[ts])
                ls++,ts++;
            else
            ts++;
            if(s[le]==t[te])
                le--,te--;
            else te--;
        }
        if(ls>le)
            printf("Yes
");
        else printf("No
");
    }
    return 0;
}
原文地址:https://www.cnblogs.com/zhangdashuai/p/3786438.html