Language: C++

#include <bits/stdc++.h>
using namespace std;
map<string,int> mp;
map<int,string> mp1;
int n;
int main() {
    cin>>n; 
    for(int i=0;i<n;i++) {
        string st;
        cin>>st;
        mp[st]++;
        mp1[mp[st]-1]="";
        mp1[mp[st]]=st;
    }
    vector<int> maxn;
    int maxi=0;
    maxn.clear();
    for(map<string,int>::iterator it=mp.begin();it!=mp.end();it++) {
        if(maxi<it->second) {
            maxi=it->second;
            maxn.push_back(mp1[it->second]);
        }
        else if(maxi==it->second) {
            maxn.push_back(mp1[it->second]);
        }
    }
    for(int i=0;i<maxn.size();i++) cout<<maxn[i]<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:27: error: no matching function for call to 'std::vector<int>::push_back(std::map<int, std::__cxx11::basic_string<char> >::mapped_type&)'
   21 |             maxn.push_back(mp1[it->second]);
      |             ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::map<int, std::__cxx11::basic_string<char> >::mapped_type' {aka 'std::__cxx11::basic_string<char>'} to 'const std::vector<int>::value_type&' {aka 'const int&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::map<int, std::__cxx11::basic_string<char> >::mapped_type' {aka 'std::__cxx11::basic_string<char>'} to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:24:27: error: no matching function for call to 'std::vector<int>::push_back(std::map<int, std::__cxx11::basic_string<char> >::mapped_type&)'
   24 |             maxn.push_back(mp1[it->second]);
      |             ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::map<int, std::__cxx11::basic_string<char> >::mapped_type' {aka 'std::__cxx11::basic_string<char>'} to 'const std::vector<int>::value_type&' {aka 'const int&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::map<int, std::__cxx11::basic_string<char> >::mapped_type' {aka 'std::__cxx11::basic_string<char>'} to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~