题目链接 :https://vjudge.net/problem/UVA-10340
注意数组开辟大小,太小会runtime error;
1 #include<stdio.h> 2 #include<string.h> 3 #define maxn 10000000 4 char s[maxn],t[maxn]; 5 6 int main() 7 { 8 while (scanf("%s %s",s,t)!=EOF) 9 { 10 int j = 0; 11 int len_s = strlen(s); 12 int len_t = strlen(t); 13 for (int i = 0;i < len_t;i++) 14 { 15 if(s[j] == t[i]) 16 { 17 j++; 18 } 19 } 20 if(j == len_s) 21 printf("Yes\n"); 22 else 23 printf("No\n"); 24 getchar(); 25 } 26 return 0; 27 }