Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- #include <string>
- #include <fstream>
- #include <stdio.h>
- #include <set>
- using namespace std;
- int main()
- {
- #ifdef _DEBUG
- freopen("in.txt", "r", stdin);
- freopen("out.txt", "w", stdout);
- #endif
- map<string, int> bank;
- string word;
- while(cin >> word)
- {
- ++bank[word];
- }
- set<int> diff;
- diff.insert(0);
- for(auto it = bank.begin(); it != bank.end(); it++)
- {
- diff.insert(it->second);
- }
- int counter = 0;
- set<int>::iterator it_diff = diff.end();
- it_diff--;
- while(counter < 10)
- {
- for(auto it = bank.begin(); it != bank.end(); it++)
- {
- if (it->second == (*it_diff))
- {
- cout << it->first << " " << it->second << endl;
- counter++;
- }
- if (counter == 10)
- return 0;
- }
- it_diff--;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement