Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <unordered_map>
- using namespace std;
- unordered_map<string, int> users;
- int solve(string s) {
- users[s]++;
- return users[s];
- }
- int main()
- {
- while (true) {
- string name;
- cout << "Enter your name: \n";
- cin >> name;
- cout << "There are " << solve(name) << " users with the same name, including you\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement