Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstring>
- #include <stack>
- #include <bits/stdc++.h>
- #include <vector>
- #include <bitset>
- #define rep(a,b,c) for(a = b; a <= c; ++a)
- #define pob pop_back
- #define pof pop_front
- #define pub push_back
- #define ll long long int
- #define nmax 1001
- #define mod 998244353
- using namespace std;
- ifstream f("tabel.in");
- ofstream g("tabel.out");
- int main()
- {
- int n,nr2, nr, i, j;
- bool ok;
- char s1[1000000], s2[1000000];
- cin >> n;
- cin.get();
- while(n--)
- {
- cin.getline(s1, 1000001);
- cin.getline(s2, 1000001);
- nr = strlen(s1);
- nr2 = strlen(s2);
- if(nr2 < nr)
- cout << "NO"<<'\n';
- else
- {
- i = 0;
- ok = 1;
- for(j = 0; j < nr2 && ok; ++j)
- if(s1[i] == s2[j])
- {
- while(s2[j] == s1[i])
- ++j;
- j--;
- i++;
- // cout << s2[j] <<"\n";
- }
- else
- {
- if(s1[i] != s2[j - 1])
- ok = 0;
- }
- if(!ok)
- cout << "NO" <<'\n';
- else
- cout << "YES" <<'\n';
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement