细节!细节!细节决定成败,s中和t中元素比较后j要++,原来的写法没有++,导致错了很多次。擦!
#include <stdio.h>
#include <string.h>
#define N 1048576
char a[N], b[N];
int main()
{
while(~scanf("%s %s", a, b))
{
int l1 = strlen(a), l2 = strlen(b);
int i(0), j(0);
while(b[j])
{
if(a[i] == b[j])
{
i++;
if(i == l1) break;
}
j++;
}
if(i == l1) puts("Yes");
else puts("No");
}
return 0;
}