poj All in All

题目就是先给出一个母串,然后给出一个子串,看这个子串的所有字符是否在母串里按从前到后的顺序出现过

 1 #include<stdio.h>
2 #include<iostream>
3 #include<algorithm>
4 #include<string.h>
5 using namespace std;
6 #define N 100000
7 char str[N],sbr[N];
8 int main()
9 {
10 int i,j;
11 while(cin>>sbr>>str)
12 {
13 int len1=strlen(str);
14 int len2=strlen(sbr);
15 j=0;
16 for(i=0;i<len1;i++)
17 {
18 if(sbr[j]==str[i]&&j<len2) j++;
19 }
20 if(j==len2) cout<<"Yes\n";
21 else cout<<"No\n";
22 }
23 return 0;
24 }
原文地址:https://www.cnblogs.com/fxh19911107/p/2380889.html