Advertisement
OMEGAHEAD_MonkoX

D

Jan 20th, 2020
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4. #include <sstream>
  5. #include <algorithm>
  6. #include <vector>
  7. #include <stdlib.h>
  8. #include <stdio.h>
  9. #include <fstream>
  10. #include <stack>
  11. #include <map>
  12. #include <cstring>
  13. #include <cmath>
  14. #include <set>
  15. #include <iterator>
  16. #include <cmath>
  17.  
  18. using namespace std;
  19.  
  20. istream & operator >> (istream & in, vector<int> & v)
  21. {
  22. string str;
  23. getline(in,str);
  24. stringstream stream(str);
  25. int tmp;
  26. while(stream >> tmp)
  27. v.push_back(tmp);
  28. return in;
  29. }
  30.  
  31. ostream & operator << (ostream & out, vector<int> const & v)
  32. {
  33. for(int el: v)
  34. out << el << ' ';
  35. return out;
  36. }
  37.  
  38.  
  39. int main()
  40. {
  41. string str;
  42. set<string> s;
  43. int ma = -1000;
  44. map<string,int> Kolvo;
  45. string a;
  46. while (cin >> a)
  47. {
  48. Kolvo.insert({a, 0});
  49. Kolvo[a]++;
  50. s.insert(a);
  51. }
  52. for (auto i = s.begin(); i != s.end(); ++i)
  53. {
  54. if (Kolvo[*i] > ma)
  55. {
  56. ma = Kolvo[*i];
  57. str = *i;
  58. }
  59. }
  60. cout << str;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement