bappi2097

D - Guessing Messages

Aug 19th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. void inOut()
  4. {
  5.     ios_base::sync_with_stdio(false);
  6.     cin.tie(NULL);
  7.  
  8.     #ifndef ONLINE_JUDGE
  9.         freopen("input.txt", "r", stdin);
  10.         //freopen("output.txt", "w", stdout);
  11.     #endif
  12. }
  13.  
  14. int main()
  15. {
  16.     inOut();
  17.     string s,r;
  18.  
  19.     cin>> s >> r;
  20.     int len = r.size();
  21.  
  22.     int a=0,ct=0;
  23.     for(int i=0; i<s.size(); i++)
  24.     {
  25.         if(s[i]==r[a])a++;
  26.         if(a==len)break;
  27.     }
  28.     if(len == a)
  29.        cout<<"YES"<<endl;
  30.     else
  31.         cout<<"NO"<<endl;
  32.     //if()
  33. }
Add Comment
Please, Sign In to add comment