Language: C++

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
    int len;
    cin >> len;
    vector<string> strs;
    vector<int> nums;
    vector<string> maxstrs;
    vector<int> maxnums;
    for (int i = 0; i < len; i++){
        string str;
        cin >> str;
        auto itr = find(strs.begin(), strs.end(), str);
        if (itr == strs.end()){
           strs.push_back(str);
           nums.push_back(0);
        }else{
            size_t index = distance(strs.begin(), itr);
            nums[index] += 1;
        }
    }
    auto maxitr = nums.begin();
    int maxscore = *max_element(nums.begin(), nums.end());
    for (;;){
        maxitr = find(maxitr, nums.end(), maxscore);
        if (maxitr == nums.end()){
            break;
        }
        size_t maxindex = distance(nums.begin(), maxitr);
        maxstrs.push_back(strs[maxindex]);
        ++maxitr;
    }
    sort(maxstrs.begin(), maxstrs.end());
    for(string maxstr : maxstrs){
        cout << maxstr << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:24: error: no matching function for call to 'find(std::vector<std::__cxx11::basic_string<char> >::iterator, std::vector<std::__cxx11::basic_string<char> >::iterator, std::string&)'
   17 |         auto itr = find(strs.begin(), strs.end(), str);
      |                    ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:17:24: note:   '__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > >' is not derived from 'std::istreambuf_iterator<_CharT>'
   17 |         auto itr = find(strs.begin(), strs.end(), str);
      |                    ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:27:21: error: 'max_element' was not declared in this scope
   27 |     int maxscore = *max_element(nums.begin(), nums.end());
      |                     ^~~~~~~~~~~
a.cc:29:22: error: no matching function for call to 'find(__gnu_cxx::__normal_iterator<int*, std::vector<int> >&, std::vector<int>::iterator, int&)'
   29 |         maxitr = find(maxitr, nums.end(), maxscore);
      |                  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:29:22: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   29 |         maxitr = find(maxitr, nums.end(), maxscore);
      |                  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:37:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   37 |     sort(maxstrs.begin(), maxstrs.end());
      |     ^~~~
      |     short