当前位置:编程学习 > C/C++ >>

10340 - All in All

[cpp]  
描述:从t字符串中查找s字符串,查到,就输出Yes,否则,输出No  
#include <cstdio>  
#include <cstdlib>  
#include <cstring>  
char s[10010],t[1000010];  
int main()  
{  
    //freopen("a.txt","r",stdin);  
    while(scanf("%s%s",s,t)!=EOF)  
    {  
        int len_s=strlen(s),len_t=strlen(t),count=0;  
        for(int i=0; i<len_t; i++)  
            if(count<len_s)  
            {  
                if(t[i]==s[count]) count++;  
            }  
            else break;  
        if(count==len_s) printf("Yes\n");  
        else printf("No\n");  
    }  
    return 0;  
}  
 
补充:软件开发 , C++ ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,