Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <cctype>
- #include <cstdio>
- #include <iostream>
- #include <vector>
- #include <set>
- #include <map>
- #include <stack>
- #include <queue>
- #include <string>
- #include <cmath>
- #include <iomanip>
- #include <algorithm>
- #define fori(start,end) for (int i = start; i < end;i++)
- #define forj(start,end) for (int j = start; j < end;j++)
- #define all(arr) arr.begin(),arr.end()
- #define nline printf("\n")
- #define pb push_back
- #define veci vector<int>
- #define vecb vector<bool>
- #define vecl vector<long long>
- #define vecpi vector<pair<int,int>>
- #define vecveci vector<vector<int>>
- #define vecd vector<double>
- #define vecs vector<string>
- typedef long long ll;
- using namespace std;
- const int INF = 1e9+5;
- const ll inf = 1e18;
- const double PI = 3.1415926535897932384626433832795;
- ll gcd(ll a, ll b){
- if(b == 0) return a;
- return gcd(b,a%b);
- }
- bool cmp(pair<int,string>&a,pair<int,string>&b){
- return a.first > b.first || a.first == b.first && a.second < b.second;
- }
- int main(){
- freopen("input.txt","r",stdin);
- string s;
- map<string,int> mp;
- while(cin >> s){
- mp[s]++;
- }
- vector<pair<int,string>> ans;
- for(auto it = mp.begin();it != mp.end();++it){
- ans.pb({it->second,it->first});
- }
- sort(all(ans),cmp);
- for(auto&i:ans){
- printf("%s\n",i.second.c_str());
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement