fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <map>
  4.  
  5. int main()
  6. {
  7. std::map<std::string, int> dictionary;
  8. std::string input;
  9. while(std::cin >> input && input != "**END**")
  10. ++dictionary[input];
  11. for(const auto& e: dictionary)
  12. if(e.second > 1)
  13. std::cout << e.first << ' ' << e.second << '\n';
  14. }
  15.  
Success #stdin #stdout 0s 3484KB
stdin
Hello
My
Name
Is
Name
LOL
LOL
**END**
stdout
LOL 2
Name 2