fork download
  1. #include <iostream>
  2. #include <map>
  3.  
  4. int main()
  5. {
  6. std::map<int,int> wordcount;
  7. int read_value;
  8. while (std::cin >> read_value)
  9. ++wordcount[read_value];
  10. for (auto it = wordcount.begin(); it != wordcount.end(); ++it)
  11. if (it->second > 1)
  12. std::cout << it->first << std::endl;
  13. return 0;
  14. }
Success #stdin #stdout 0s 3436KB
stdin
1
1
2
3 
34
5
34
stdout
1
34