Language: C++

#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

int cntMatch(string left, string right){
	int cnt = 0;
	for(char c='a'; c<='z'; c++){
		if(find(left.begin(), left.end(), c)!=left.end() && find(right.begin(), right.end(), c)!=right.end())
			cnt++;
	}

	return cnt;
}

int main(void)
{
	int N;
	cin >> N;

	string str;
	cin >> str;

	int ret = 0;
	for(int i=1; i<N-1; i++){
		ret = max(ret, cntMatch(str.substr(0, i), str.substr(i, N-i)));
	}

	cout << ret << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int cntMatch(std::string, std::string)':
a.cc:10:24: error: no matching function for call to 'find(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, char&)'
   10 |                 if(find(left.begin(), left.end(), c)!=left.end() && find(right.begin(), right.end(), c)!=right.end())
      |                    ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:10:24: note:   '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   10 |                 if(find(left.begin(), left.end(), c)!=left.end() && find(right.begin(), right.end(), c)!=right.end())
      |                    ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:10:73: error: no matching function for call to 'find(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, char&)'
   10 |                 if(find(left.begin(), left.end(), c)!=left.end() && find(right.begin(), right.end(), c)!=right.end())
      |                                                                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:10:73: note:   '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   10 |                 if(find(left.begin(), left.end(), c)!=left.end() && find(right.begin(), right.end(), c)!=right.end())
      |                                                                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~