All in All

http://poj.org/problem?id=1936

 1 #include<cstdio>
 2 #include<cstring>
 3 #include<algorithm>
 4 #define max 100010
 5 using namespace std;
 6 char s[max],s1[max];
 7 int main()
 8 {
 9     while(scanf("%s %s",s,s1)!=EOF){
10 
11         int k1=strlen(s);
12         int k2=strlen(s1);
13         int t=0,c=0;
14         for(int i=0;i<k1;i++)
15         {
16             for(int j=c;j<k2;j++)
17             {
18                 if(s[i]==s1[j])
19                 {
20                     t++;
21                     c=j+1;
22                     break;
23                 }
24             }
25         }
26         if(t==k1) printf("Yes
");
27         else printf("No
");
28     }
29     return 0;
30 }
View Code
原文地址:https://www.cnblogs.com/fanminghui/p/3249057.html