Advertisement
XandreasrektsX

Untitled

Oct 17th, 2019
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <map>
  2. #include <cstdio>
  3. #include <vector>
  4. #include <iostream>
  5. #include <algorithm>
  6. using namespace std;
  7.  
  8.  
  9. int main() {
  10.  
  11. int N,maxx=-1, maxxp=0;
  12.  
  13. cin >> N;
  14.  
  15. string str;
  16.  
  17. map<string, int> M;
  18. vector<string> V;
  19. for(int i = 0; i<N*2; i++){
  20. cin >> str;
  21. M[str] += 1;
  22. }
  23. for(map<string,int>::iterator itt = M.begin(); itt != M.end(); ++itt){
  24. if(itt->second > maxx){
  25. maxx = itt->second;
  26. }
  27. }
  28.  
  29.  
  30.  
  31. map<int, string> RM;
  32.  
  33. for(auto x:M){
  34. RM[x.second] = x.first;
  35. }
  36.  
  37. cout << RM.size() << endl;
  38.  
  39. for(auto x:RM){
  40. if(x.first == maxx){
  41. cout << x.second << endl;
  42. }
  43. }
  44.  
  45.  
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement