Language: C++

/******* VIVEK PAl *******/
/*************************/
#include <bits/stdc++.h>
#define prime 1000000007
#define mod 100008
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
/****** END OF HEADER ******/
/***************************/
void fastIO(void);

bool cmp(pair<int,string>a, pair<int,string>b){
  int n=(a.second).compare((b.second));
  if(n<0) n=0;
  if(a.first == b.first) return (n);
  return (a.first > b.first);
}
void solve()
{
    int N; cin>>N;
    map<string, int> A;
    for(int i=0;i<N;i++){
      string str; cin>>str;
      if(A.find(str)==A.end()) A.insert(make_pair(str,1));
      else A[str]+=1;
    }
    vector<pair<int, string> >ans;
    for(auto i=A.begin();i!=A.end();i++){
        ans.push_back(make_pair(i->second,i->first));
    }
    sort(ans.begin(), ans.end(), cmp);
    N=ans.size();
    int sun=ans[0].first;
    for(int i=N-1;i>=0;i--){
      if(ans[i].first==sun) cout<<ans[i].second<<'\n';
    }
}
int main()
{
  fastIO();
  int T=1, t;
  //cin>>T;
  t = T;
  while(T--)
    {
        //printf("Case #%d: ", t-T);
        solve();
    }
}


void fastIO(void)
{  ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
}/******* VIVEK PAl *******/
/*************************/
#include <bits/stdc++.h>
#define prime 1000000007
#define mod 100008
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
/****** END OF HEADER ******/
/***************************/
void fastIO(void);

bool cmp(pair<int,string>a, pair<int,string>b){
  int n=(a.second).compare((b.second));
  if(n<0) n=0;
  if(a.first == b.first) return (n);
  return (a.first > b.first);
}
void solve()
{
    int N; cin>>N;
    map<string, int> A;
    for(int i=0;i<N;i++){
      string str; cin>>str;
      if(A.find(str)==A.end()) A.insert(make_pair(str,1));
      else A[str]+=1;
    }
    vector<pair<int, string> >ans;
    for(auto i=A.begin();i!=A.end();i++){
        ans.push_back(make_pair(i->second,i->first));
    }
    sort(ans.begin(), ans.end(), cmp);
    N=ans.size();
    int sun=ans[0].first;
    for(int i=N-1;i>=0;i--){
      if(ans[i].first==sun) cout<<ans[i].second<<'\n';
    }
}
int main()
{
  fastIO();
  int T=1, t;
  //cin>>T;
  t = T;
  while(T--)
    {
        //printf("Case #%d: ", t-T);
        solve();
    }
}


void fastIO(void)
{  ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
}

Compiler output:
a.cc:71:6: error: redefinition of 'bool cmp(std::pair<int, std::__cxx11::basic_string<char> >, std::pair<int, std::__cxx11::basic_string<char> >)'
   71 | bool cmp(pair<int,string>a, pair<int,string>b){
      |      ^~~
a.cc:14:6: note: 'bool cmp(std::pair<int, std::__cxx11::basic_string<char> >, std::pair<int, std::__cxx11::basic_string<char> >)' previously defined here
   14 | bool cmp(pair<int,string>a, pair<int,string>b){
      |      ^~~
a.cc:77:6: error: redefinition of 'void solve()'
   77 | void solve()
      |      ^~~~~
a.cc:20:6: note: 'void solve()' previously defined here
   20 | void solve()
      |      ^~~~~
a.cc:97:5: error: redefinition of 'int main()'
   97 | int main()
      |     ^~~~
a.cc:40:5: note: 'int main()' previously defined here
   40 | int main()
      |     ^~~~
a.cc:111:6: error: redefinition of 'void fastIO()'
  111 | void fastIO(void)
      |      ^~~~~~
a.cc:54:6: note: 'void fastIO()' previously defined here
   54 | void fastIO(void)
      |      ^~~~~~