Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <algorithm>
- #include <vector>
- #include <string>
- #include <unordered_map>
- #include <map>
- #include <queue>
- #include <unordered_set>
- using namespace std;
- typedef long long int ll;
- bool contain(string a, char b)
- {
- for (int i=0; i<a.size(); i++)
- if (a[i]>-5&&a[i]<30) return true;
- return false;
- }
- bool compare(pair <int, string> a, pair <int, string> b)
- {
- if (a.first>b.first) return true;
- if (a.first<b.first) return false;
- if (a.first == b.first && a.second>b.second) return false;
- if (a.first == b.first && a.second<b.second) return true;
- return false;
- }
- int main(){
- char end = -1;
- unordered_map <string, int> m;
- string a;
- while(cin>>a){
- m[a]++;}
- vector <pair<int, string> > res;
- for (auto it=m.begin(); it != m.end(); it++)
- {
- res.push_back(make_pair(it->second, it->first));
- }
- sort (res.begin(), res.end(), compare);
- for (int i=0; i<res.size(); i++)
- cout<<res[i].second<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement