Advertisement
Rofyda_Elghadban1

Untitled

Sep 13th, 2023
1,131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.30 KB | None | 0 0
  1.  /*Rofyda Mohamed Hamed Hamed Elghadban*/
  2.  //#include <bits/stdc++.h>
  3.  #include <iostream>
  4.  #include <iomanip>
  5.  #include <cmath>
  6.  #include <algorithm>
  7.  #include <cstdlib>
  8.  #include <limits.h>
  9.  #include <string>
  10.  #include <vector>
  11.  #include <map>
  12.  #include <stack>
  13.  #include <set>
  14.  #include <deque>
  15.  #include <fstream>
  16.  #include <bitset>
  17.  #include <cmath>
  18.  #include <numeric>
  19.  #include <cstring>
  20.  #include <utility>
  21.  #include <queue>
  22.  
  23.  /***********************************************************************************/
  24.  
  25.  #define ll long long
  26.  #define ull unsigned long long
  27.  #define pi 3.141592654
  28.  #define NUM 1e18
  29.  #define Mod  1'000'000'007
  30.  #define fixed(n) fixed<<setprecision(n)
  31.  #define cin(v) for(auto &i:v) cin >> i ;
  32.  #define cout(v) for(auto &i:v) cout << i  <<" ";
  33.  #define vowel(x) (x=='e'||x=='a'||x=='i'||x=='o'||x=='u')
  34.  #define small(x) (x>=97&&x<=122)
  35.  #define capital(x) (x>=65&&x<=90)
  36.  #define Tolower(s) transform(s.begin(),s.end(),s.begin(),::tolower);
  37.  #define Toupper(s) transform(s.begin(),s.end(),s.begin(),::toupper);
  38.  #define all(v) ((v).begin()), ((v).end())
  39.  #define allr(v) ((v).rbegin()), ((v).rend())
  40.  #define updmax(a,b) a=max(a,b)
  41.  #define updmin(a,b) a=min(a,b)
  42.  #define ceil(a,b) ((a/b)+(a%b?1:0))
  43.  /* asc -> 1 2 3 ,des -> 3 2 1 */
  44.  
  45.  /***********************************************************************************/
  46.  
  47.  using namespace std;
  48.  
  49.  void Rofyda_Elghadban(){
  50.   #ifndef ONLINE_JUDGE  
  51.     freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  52.    #endif
  53.     ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  54.  }
  55.  
  56.  void solve(){
  57.  }
  58.  
  59.  ll prefix[10000001]{},mini=LLONG_MAX;
  60.  
  61.  int main(){
  62.   Rofyda_Elghadban();
  63.  //freopen("input.txt","r",stdin);
  64.  //freopen("output.txt","r",stdout);
  65.  //solve();
  66.  
  67.  int t;
  68.  cin>>t;
  69.  while(t--){
  70.   string s,t,p;
  71.   cin>>s>>t>>p;
  72.   int freq[123]{},counter=0,idx=0;
  73.   for(int i=0;i<p.size();i++){
  74.     freq[p[i]]++;
  75.   }
  76.   for(int i=0;i<t.size();i++){
  77.     if(t[i]==s[idx]){
  78.       idx++;
  79.       counter++;
  80.     }else if(t[i]!=s[idx]){
  81.       if(freq[t[i]]>0){
  82.         freq[t[i]]--;
  83.         counter++;
  84.       }
  85.     }
  86.   }
  87.   if(idx==s.size()&&counter==t.size()){
  88.     cout<<"YES"<<"\n";
  89.   }else{
  90.     cout<<"NO"<<"\n";
  91.   }
  92.  }
  93.  
  94.  
  95.  
  96.  return 0;
  97. }
  98.  
  99.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement