#include <algorithm> #include <iostream> #include <map> #include <utility> #include <vector> #include<string> using namespace std; int main() { string s; map<string, int> mymap; while(cin>>s){ if(mymap.find(s) != mymap.end()){ mymap[s]=mymap[s]+1; }else{ mymap[s]=1; } } vector<pair<string,int>> arr; for(const auto& pair:mymap){ if(pair.second>=3){ arr.emplace_back(pair.first,pair.second); } } sort(arr.begin(), arr.end(),[](const auto& a,const auto& b){ return a.second==b.second? a.first<b.first:a.second>b.second; }); for(const auto& e:arr){ cout<<e.first<<endl; } return 0; } // 64 位输出请用 printf("%lld")