[cpp] 描述:從t字符串中查找s字符串,查到,就輸出Yes,否則,輸出No #include <cstdio> #include <cstdlib> #include <cstring> char s[10010],t[1000010]; int main() { //freopen("a.txt","r",stdin); while(scanf("%s%s",s,t)!=EOF) { int len_s=strlen(s),len_t=strlen(t),count=0; for(int i=0; i<len_t; i++) if(count<len_s) { if(t[i]==s[count]) count++; } else break; if(count==len_s) printf("Yes\n"); else printf("No\n"); } return 0; }