MohamedAbdel3al

B. Letter

Sep 10th, 2021 (edited)
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std ;
  4. #define sz(s) int(s.size())
  5. typedef long long ll ;
  6.  
  7.  
  8. void ABDEL3AL () {
  9. ios_base::sync_with_stdio(false); cin.tie(nullptr) , cout.tie(nullptr) ;
  10. #ifndef ONLINE_JUDGE
  11. freopen("input.txt" , "r" , stdin) , freopen("output.txt" , "w" , stdout) ;
  12. #endif
  13.  
  14. }
  15.  
  16. int main() {
  17. ABDEL3AL() ;
  18. string s , t ;
  19. getline(cin >> ws, s) ;
  20. getline(cin >> ws, t) ;
  21. int freq_f[127] = {0} ;
  22. int freq_s[127] = {0} ;
  23. for (int i = 0; i < sz(s); i++)
  24. if (s[i] != ' ')
  25. freq_f[s[i]]++ ;
  26. for (int i = 0; i < sz(t); i++)
  27. if (t[i] != ' ')
  28. freq_s[s[i]]++ ;
  29. bool found = true ;
  30. for (int i = 0; i < 127; i++)
  31. if (freq_s[i] && freq_f[i])
  32. if (freq_f[i] >= freq_s[i]);
  33. else found = false ;
  34. cout << (found ? "YES" : "NO") ;
  35.  
  36. return 0;
  37. }
Add Comment
Please, Sign In to add comment