算法入门经典第二版 3-9 All in All

来源:互联网 发布:淘宝邮票哪家好 编辑:程序博客网 时间:2024/06/05 00:56
#include <stdio.h>#include <string.h>#define INF 100000char s1[INF],s2[INF];int main(){    while(scanf("%s %s",s1,s2) != EOF) {        bool f = true;        int t = 0; char *p = NULL;        for(int i = 0; i < strlen(s1); i++) {            if(p = strchr(s2+t,s1[i]))                    t = p - s2 + 1;            else                 { f = false; break;}                }        printf("%s\n",f?"Yes":"No");    }    return 0;}