Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int t;
- cin>>t;
- while(t--)
- {
- string a,b,str;
- cin>>a>>b;
- int x=a.size(),y=b.size();
- if(y<x)cout<<"NO"<<endl;
- else
- {
- int i=0,j=0;
- bool f= false;
- while(i<x || j<y)
- {
- if(a[i]==b[j])
- {
- str+=b[j];
- i++,j++;
- }
- else
- {
- if(a[i-1]==b[j])
- j++;
- else
- {
- f=true;
- break;
- }
- }
- }
- if(f)cout<<"NO"<<endl;
- else if(str==a)cout<<"YES"<<endl;
- else cout<<"NO"<<endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement