Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N ;
  cin >> N ;
  string B[N] ;
  for ( int i=0 ; i<N ; i++ ){
    cin >> B[i] ;
  }
  int M ;
  cin >> M ;
  string R[M] ;
  for ( int i=0 ; i<M ; i++ ){
    cin >> R[M] ;
  }
  
  int ben =0;
  for ( int i= 0 ; i<N ; i++){
   if (B[i] == "A"){
     continue ;
   }else {
     for ( int j = i+1 ; j<N; j++){
       int count = 1;
       if ( B[i] == B[j]) {
         count ++;
         B[j] == "A";
       }
     }
     for (int j=0 ; j<M ; j++){
       if (B[i] == R[j]){
         count -- ;
       }
     }
     ben = max ( ben , count);
  }
  }
    cout << ben << endl;
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:15: warning: ignoring return value of 'bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*) [with _CharT = char; _Traits = char_traits<char>; _Alloc = allocator<char>]', declared with attribute 'nodiscard' [-Wunused-result]
   27 |          B[j] == "A";
      |          ~~~~~^~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:3772:5: note: declared here
 3772 |     operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
a.cc:32:16: error: no post-decrement operator for type
   32 |          count -- ;
      |                ^~
a.cc:35:16: error: no matching function for call to 'max(int&, <unresolved overloaded function type>)'
   35 |      ben = max ( ben , count);
      |            ~~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'constexpr const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = int]'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:36: note:   no known conversion for argument 2 from '<unresolved overloaded function type>' to 'const int&'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |                         ~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:35:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   35 |      ben = max ( ben , count);
      |            ~~~~^~~~~~~~~~~~~~