1. 程式人生 > >All in All,( UVa, 10340 )

All in All,( UVa, 10340 )

tchar i++ for runtime efi ror fin getchar ()

題目鏈接 :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 }

All in All,( UVa, 10340 )