http://poj.org/problem?id=1936

额,这个用到啥了?好像只有字符串以'\0'为结尾吧...

code:

#include<cstdio>
char str[100001] ;
char substr[100001] ;
int main(){
    int i, j ;
    while(~scanf("%s%s", substr, str)){
        i = 0, j = 0 ;
        while(substr[i]!='\0'&&str[j]!='\0'){
            if(substr[i]==str[j])
                i ++ ;
            j ++ ;
        }
        if(substr[i]=='\0')
            printf("Yes\n") ;
        else
            printf("No\n") ;
    }

}

posted on 2012-02-05 19:19  追逐.  阅读(126)  评论(0编辑  收藏  举报