Bob103

map1

Jul 12th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <map>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. freopen("input.txt", "r", stdin);
  9. map<string, int>q;
  10. string str, last;
  11. while (cin >> str){
  12. q[str]++;
  13. last = str;
  14. }
  15. int needCount = q[last];
  16. for (auto it = q.begin(); it != q.end(); it++) {
  17. if ((it->second) == needCount)
  18. cout << it->first << " ";
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment