现在的位置: 首页 > 综合 > 正文

poj1936找子串

2013年08月26日 ⁄ 综合 ⁄ 共 273字 ⁄ 字号 评论关闭
#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;
}

抱歉!评论已关闭.