fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. int main() {
  5. // your code goes here
  6. ll t;
  7. cin>>t;
  8. map<string,ll>mp1;
  9. map<string,ll>mp2;
  10. string s;
  11. vector<string >v1;
  12. vector<string>v2;
  13. set<ll>k;
  14. for(ll i=0;i<t;i++){
  15. cin>>s;
  16. v1.push_back(s);
  17. mp1[s]++;
  18. }
  19. for(ll i=0;i<t;i++) {
  20. cin>>s;
  21. v2.push_back(s);
  22. mp2[s]++;
  23. }
  24. ll p=0;
  25. for(auto itr : mp1){
  26. if(mp2[itr.first] >= itr.second ){
  27. itr.second =0;
  28. }
  29. else itr.second -= mp2[itr.first];
  30. p+=itr.second;
  31. }cout<<p;
  32. return 0;
  33. }
Success #stdin #stdout 0.01s 5568KB
stdin
2
M
XS
XS
M
stdout
Standard output is empty