P59 子序列(All in ALl)

大牛的代码总是让人兴叹(!- !)

#include<stdio.h>
#include<string.h>
char s[100000],t[100000];
int main()
{
    int i,j,k1,k2;
    while(scanf("%s%s",s,t)==2)
    {
        k1=strlen(s);
        k2=strlen(t);
        if(k1>=k2)
        {
            printf("No
");
            continue;
        }
        for(i=0,j=0;t[j]!=''&&i<k1;j++)//看看这多个变量作循环的处理。
        {
            if(k1-i>k2-j)
                break;
            if(s[i]==t[j])
                i++;
        }
        if(i==k1)
            printf("Yes
");
        else
            printf("No
");
    }
    return 0;    
}
原文地址:https://www.cnblogs.com/laoyangtou/p/8866937.html