Address: All in all
Question:
The sequence cannot be changed to determine whether the last string contains the previous string.
Solution:
The next string is a loop, and the character in the string to be judged is equal to CNT ++. Finally, CNT = Len (the string to be judged) is output yes or no.
Code:
1 # include <algorithm> 2 # include <iostream> 3 # include <sstream> 4 # include <cstdlib> 5 # include <cstring> 6 # include <cstdio> 7 # include <string> 8 # include <bitset> 9 # include <vector> 10 # include <queue> 11 # include <stack> 12 # include <cmath> 13 # include <list> 14/ /# include <map> 15 # include <set> 16 using namespace STD; 17 /************************************** */18 # define ll long long19 # define in T64 _ int6420 /*********************************** * ***/21 const int INF = 0x7f7f7f7f; 22 const double EPS = 1e-8; 23 const double PIE = ACOs (-1.0); 24 const int d1x [] = }; 25 const int d1y [] = {0,-}; 26 const int d2x [] = {0,-, 1}; 27 const int d2y [] =, -}; 28 const int FX [] = {-1,-1,-,}; 29 const int FY [] = {-, 1, -,-, 1 }; 30 /************************************** */31 void o Penfile () 32 {33 freopen ("data. in "," rb ", stdin); 34 freopen (" data. out "," WB ", stdout); 35} 36/************************* gorgeous split line, the above is the template section ***************/37 char S1 [100001], s [100001]; 38 int main () 39 {40 while (scanf ("% s", S1 )! = EOF) 41 {42 scanf ("% s", S); 43 int I, j; 44 int len1 = strlen (S1); 45 int len2 = strlen (s ); 46 int D = 0; 47 int CNT = 0; 48 for (I = 0; I <len2; I ++) 49 {50 if (s [I]! = S1 [d]) 51 continue; 52 If (s [I] = S1 [d]) 53 {54 CNT ++; 55 d ++; 56} 57 58} 59 If (CNT = len1) 60 printf ("Yes \ n"); 61 else62 printf ("NO \ n"); 63} 64 return 0; 65}
View code