Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  int N,M;
  cin >> N;
  vector<string> s(N);
  for(int i=0;i<N;i=i+1)cin >> s.at(i);
  cin >> M;
  vector<string> t(M);
  for(int i=0;i<M;i=i+1)cin >> t.at(i);
  map<string,int> yen;
  for(int x:s){
    if(yen.count(x)){
      yen.at(x) = yen.at(x) + 1;
    }
    else{
      yen.at(x) = 1;
    }
  }
  for(int x:t){
    if(yen.count(x)){
      yen.at(x) = yen.at(x) - 1;
    }
    else{
      yen.at(x) = -1;
    }
  }
  int max_yen = 0;
  for(int i=0;i<N;i=i+1){
    max_yen = max(max_yen,yen.at(s.at(i)));
  }
  for(int i=0;i<M;i=i+1){
    max_yen = max(max_yen,yen.at(t.at(i)));
  }
  cout << max_yen << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: cannot convert 'std::__cxx11::basic_string<char>' to 'int' in initialization
   13 |   for(int x:s){
      |             ^
a.cc:14:17: error: no matching function for call to 'std::map<std::__cxx11::basic_string<char>, int>::count(int&)'
   14 |     if(yen.count(x)){
      |        ~~~~~~~~~^~~
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:1270:9: note: candidate: 'template<class _Kt> decltype (((const std::map<_Key, _Tp, _Compare, _Alloc>*)this)->std::map<_Key, _Tp, _Compare, _Alloc>::_M_t._M_count_tr(__x)) std::map<_Key, _Tp, _Compare, _Alloc>::count(const _Kt&) const [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >]'
 1270 |         count(const _Kt& __x) const -> decltype(_M_t._M_count_tr(__x))
      |         ^~~~~
/usr/include/c++/14/bits/stl_map.h:1270:9: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_map.h: In substitution of 'template<class _Kt> decltype (((const std::map<std::__cxx11::basic_string<char>, int>*)this)->std::map<std::__cxx11::basic_string<char>, int>::_M_t.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::_M_count_tr<_Kt, _Req>(__x)) std::map<std::__cxx11::basic_string<char>, int>::count(const _Kt&) const [with _Kt = int]':
a.cc:14:17:   required from here
   14 |     if(yen.count(x)){
      |        ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_map.h:1270:65: error: no matching function for call to 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::_M_count_tr(const int&) const'
 1270 |         count(const _Kt& __x) const -> decltype(_M_t._M_count_tr(__x))
      |                                                 ~~~~~~~~~~~~~~~~^~~~~
In file included from /usr/include/c++/14/map:62:
/usr/include/c++/14/bits/stl_tree.h:1311:9: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_count_tr(const _Kt&) const [with _Req = _Kt; _Key = std::__cxx11::basic_string<char>; _Val = std::pair<const std::__cxx11::basic_string<char>, int>; _KeyOfValue = std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >]'
 1311 |         _M_count_tr(const _Kt& __k) const
      |         ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_tree.h:1311:9: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/14/string:49,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/stl_function.h: In substitution of 'template<class _Func, class _SfinaeType> using std::__has_is_transparent_t = typename std::__has_is_transparent<_Func, _SfinaeType>::type [with _Func = std::less<std::__cxx11::basic_string<char> >; _SfinaeType = int]':
/usr/include/c++/14/bits/stl_tree.h:1309:9:   required by substitution of 'template<class _Kt> decltype (((const std::map<std::__cxx11::basic_string<char>, int>*)this)->std::map<std::__cxx11::basic_string<char>, int>::_M_t.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::_M_count_tr<_Kt, _Req>(__x)) std::map<std::__cxx11::basic_string<char>, int>::count(const _Kt&) const [with _Kt = int]'
 1309 |                typename _Req = __has_is_transparent_t<_Compare, _Kt>>
      |                ^~~~~~~~
a.cc:14:17:   required from here
   14 |     if(yen.count(x)){
      |        ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_function.h:1427:11: error: no type named 'type' in 'struct std::__has_is_transparent<std::less<std::__cxx11::basic_string<char> >, int, void>'
 1427 |     using __has_is_transparent_t
      |           ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_map.h:1264:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::size_type std::map<_Key, _Tp, _Compare, _Alloc>::count(const key_type&) const [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; size_type = long unsigned int; key_type = std::__cxx11::basic_string<char>]'
 1264 |       count(const key_type& __x) const
      |       ^~~~~
/usr/include/c++/14/bits/stl_map.h:1264:29: note:   no known conversion for argument 1 from 'int' to 'const std::map<std::__cxx11::basic_string<char>, int>::key_type&' {aka 'const std::__cxx11::basic_string<char>&'}
 1264 |       count(const key_type& __x) const
      |             ~~~~~~~~~~~~~~~~^~~
a.cc:15:13: error: no matching function for call to 'std::map<std::__cxx11::basic_string<char>, int>::at(int&)'
   15 |       yen.at(x) = yen.at(x) + 1;
      |       ~~~~~~^~~
/usr/include/c++/14/bits/stl_map.h:549:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::at(const key_type&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; mapped_type = int; key_type = std::__cxx11::basic_string<char>]'
  549 |       at(const key_type& __k)
      |       ^~
/usr/include/c++/14/bits/stl_map.h:549:26: note:   no known conversion for argument 1 from 'int' to 'const std::map<std::__cxx11::basic_string<char>, int>::key_type&' {aka 'const std::__cxx11::basic_string<char>&'}
  549 |       at(const key_type& __k)
      |          ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_map.h:558:7: note: candidate: 'const std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::at(const key_type&) const [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; mapped_type = int; key_type = std::__cxx11::basic_string<char>]'
  558 |       at(const key_type& __k) const
      |       ^~
/usr/include/c++/14/bits/stl_map.h:558:26: note:   no known conversion for argument 1 from 'int' to 'const std::map<std::__cxx11::basic_string<char>, int>::key_type&' {aka 'const std::__cxx11::basic_string<char>&'}
  558 |       at(const key_type& __k) const
      |          ~~~~~~~~~~~~~~~~^~~
a.cc:15:25: error: no matching function for call to 'std::map<std::__cxx11::basic_string<char>, int>::at(int&)'
   15 |       yen.at(x) = yen.at(x) + 1;
      |                   ~~~~~~^~~
/usr/include/c++/14/bits/stl_map.h:549:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::at(const key_type&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; mapped_type = int; key_type = std::__cxx11::basic_string<char>]'
  549 |       at(const key_type& __k)
      |       ^~
/usr/include/c++/14/bits/stl_map.h:549:26: note:   no known conversion for argument 1 from 'int' to 'const std::map<std::__cxx11::basic_string<char>, int>::key_type&' {aka 'const std::__cxx11::basic_string<char>&'}
  549 |       at(const key_type& __k)
      |          ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_map.h:558:7: note: candidate: 'const std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::at(const key_type&) const [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; mapped_type = int; key_type = std::__cxx11::basic_string<char>]'
  558 |       at(const key_type& __k) const
      |       ^~
/usr/include/c++/14/bits/stl_map.h:558:26: note:   no known conversion for argument 1 from 'int' to 'const std::map<std::__cxx11::basic_string<char>, int>::key_type&' {aka 'const std::__cxx11::basic_string<char>&'}
  558 |       at(const key_type& __k) const
      |          ~~~~~~~~~~~~~~~~^~~
a.cc:18:13: error: no matching function for call to 'std::map<std::__cxx11::basic_string<char>, int>::at(int&)'
   18 |       yen.at(x) = 1;
      |       ~~~~~~^~~
/usr/include/c++/14/bits/stl_map.h:549:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::at(const key_type&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >; mapped_type = int; key_type = std::__cxx11::basic_string<char>]'
  549 |       at(const key_type& __k)
      |       ^~
/usr/include/c++/14/bits/stl_map.h:549:26: note:   no known conversion for argument 1 from 'int' to 'const std::map<std::__cxx11::basic_string<char>, int>::key_type&' {aka 'const std::__cxx11::basic_string<char>&'}
  549 |       at(const key_type& __k)
      |          ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_map.h:558:7: note: candidate: 'const std::map<_Key, _Tp, _Compare, _All