Harman5007

Untitled

Apr 15th, 2020
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. void checkMagazine(vector<string> magazine, vector<string> note) {
  2.  
  3.  
  4. string m;
  5. for(auto i:magazine)
  6. {
  7. m += i;
  8. }
  9. string n;
  10. for(auto i:note)
  11. {
  12. n += i;
  13. }
  14.  
  15. map<char,int> mp;
  16.  
  17. for(int i=0;i<m.size();i++)
  18. {
  19. mp[m[i]]++;
  20. }
  21. for(int i=0;i<n.size();i++)
  22. {
  23. if(mp[n[i]]!=0)
  24. {
  25. mp[n[i]]--;
  26. }
  27. else
  28. {
  29. cout<<"No";
  30. return;
  31. }
  32. }
  33. cout<<"Yes";
  34. return;
  35.  
  36. }
Add Comment
Please, Sign In to add comment