Advertisement
MaxObznyi

Q.8

Nov 16th, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <unordered_map>
  3. using namespace std;
  4.  
  5. unordered_map<string, int> users;
  6.  
  7. int solve(string s) {
  8. users[s]++;
  9. return users[s];
  10. }
  11.  
  12. int main()
  13. {
  14. while (true) {
  15. string name;
  16. cout << "Enter your name: \n";
  17. cin >> name;
  18. cout << "There are " << solve(name) << " users with the same name, including you\n";
  19. }
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement