Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cstring>
  4. #include <stack>
  5. #include <bits/stdc++.h>
  6. #include <vector>
  7. #include <bitset>
  8. #define rep(a,b,c) for(a = b; a <= c; ++a)
  9. #define pob pop_back
  10. #define pof pop_front
  11. #define pub push_back
  12. #define ll long long int
  13. #define nmax 1001
  14. #define mod 998244353
  15. using namespace std;
  16. ifstream f("tabel.in");
  17. ofstream g("tabel.out");
  18.  
  19.  
  20.  
  21. int main()
  22. {
  23. int n,nr2, nr, i, j;
  24. bool ok;
  25. char s1[1000000], s2[1000000];
  26. cin >> n;
  27. cin.get();
  28. while(n--)
  29. {
  30. cin.getline(s1, 1000001);
  31. cin.getline(s2, 1000001);
  32. nr = strlen(s1);
  33. nr2 = strlen(s2);
  34. if(nr2 < nr)
  35. cout << "NO"<<'\n';
  36. else
  37. {
  38. i = 0;
  39. ok = 1;
  40. for(j = 0; j < nr2 && ok; ++j)
  41. if(s1[i] == s2[j])
  42. {
  43. while(s2[j] == s1[i])
  44. ++j;
  45. j--;
  46. i++;
  47. // cout << s2[j] <<"\n";
  48. }
  49. else
  50. {
  51. if(s1[i] != s2[j - 1])
  52. ok = 0;
  53. }
  54. if(!ok)
  55. cout << "NO" <<'\n';
  56. else
  57. cout << "YES" <<'\n';
  58. }
  59. }
  60. return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement