Advertisement
Nayeemzaman

Untitled

Aug 19th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     string s,r;
  7.  
  8.     cin>> s >> r;
  9.     int len = r.size();
  10.     int a=0,ct=0;
  11.     for(int i=0; i<r.size(); i++)
  12.     {
  13.         for(int j=a; j<s.size(); j++)
  14.         {
  15.             if(r[i]==s[j])
  16.             {
  17.                 ct++;
  18.                 a=j+1;
  19.                 break;
  20.             }
  21.         }
  22.     }
  23.     if(len == ct)
  24.        cout<<"YES"<<endl;
  25.     else
  26.         cout<<"NO"<<endl;
  27.     //if()
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement