Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <bits/stdc++.h>
- #define Nmax 1000005
- #define fs first
- #define sc second
- #define mk make_pair
- #define MOD 998244353
- #define INF 0x3f3f3f3f
- #define ll long long
- using namespace std;
- ifstream f("1.in");
- int t;
- char s1[Nmax], s2[Nmax];
- bool match(char a[], char b[])
- {
- int l1=strlen(a), l2=strlen(b);
- //cout << '\n';
- int i1=0, i2=0;
- while (i1 < l1 && i2 < l2)
- {
- int eq=1;
- while (i1+1<l1 && a[i1] == a[i1+1])
- {
- i1++;
- eq++;
- }
- int cnt=0;
- while (i2 < l2 && a[i1] == b[i2])
- {
- i2++;
- cnt++;
- }
- i1++;
- if (cnt < eq) return 0;
- }
- if (i1<l1) return 0;
- while (i2<l2)
- {
- if (b[i2]!=a[l1-1]) return 0;
- i2++;
- }
- return 1;
- }
- int main()
- {
- cin >> t;
- //t=1;
- while (t--)
- {
- cin >> s1 >> s2;
- if (match(s1, s2) == true) cout << "YES\n";
- else cout << "NO\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement