POJ 1936 All in All

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

简单题,没什么需要特别注意的。

 1 #include <stdio.h>
 2 #include <stdlib.h>
 3 #include <string.h>
 4 char *q,*p,*r;
 5 bool check(char ch,char *dst)
 6 {
 7     while(*dst) {
 8         if(*dst==ch) {
 9             r=dst+1;
10             return true;
11         }
12         dst++;
13     }
14     return false;
15 }
16 int main()
17 {
18     char s[100002],t[100002];
19     p=s;
20     q=t;
21     while(scanf("%s%s",s,t)!=EOF) {
22         p=s;
23         q=t;
24         r=q;
25         bool flag=true;
26         while(*p) {
27             if(!check(*p,q)) {
28                 printf("No\n");
29                 flag=false;
30                 break;
31             }
32             q=r;
33             p++;
34         }
35         if(flag) {
36             printf("Yes\n");
37         }
38     }
39 }
原文地址:https://www.cnblogs.com/yangce/p/2899814.html