poj1936找子串

#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int main()
{

    char s[100005],t[100005];
   char *ps,*pt;
    while(~scanf("%s%s",s,t))
    {
        ps=s;pt=t;
        while(*pt)
        {
            if(*ps==*pt){*ps++;}
            if(*ps=='\0'){cout<<"Yes"<<endl;break;}
            *pt++;
        }
        if(*ps)//如果s没有移动到最后
            cout<<"No"<<endl;

    }
    return 0;
}

你可能感兴趣的:(poj1936找子串)