Language: C++

#include<iostream>
#include<vector>

int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  
  ans = 0;
  for(int i = 0; i < N -1; i++){
    vector<bool> left(24,false);
    vector<bool> right(24,false);
    for(int j = 0; j <= i; j++){
      left[S[j] - 'a'] = true;
    }
    for(int j = i + 1; j < N; j++){
      right[S[j] - 'a'] = true;
    }
    int tmp = 0;
    for(int k = 0; k < 24; k++){
      if(left[k] && right[k]) tmp++;
    }
    ans = max(tmp, ans);
  }
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |   cin >> N;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:7:3: error: 'string' was not declared in this scope
    7 |   string S;
      |   ^~~~~~
a.cc:7:3: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:8:10: error: 'S' was not declared in this scope
    8 |   cin >> S;
      |          ^
a.cc:10:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |   ans = 0;
      |   ^~~
      |   abs
a.cc:12:5: error: 'vector' was not declared in this scope
   12 |     vector<bool> left(24,false);
      |     ^~~~~~
a.cc:12:5: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:12:12: error: expected primary-expression before 'bool'
   12 |     vector<bool> left(24,false);
      |            ^~~~
a.cc:13:12: error: expected primary-expression before 'bool'
   13 |     vector<bool> right(24,false);
      |            ^~~~
a.cc:15:7: error: 'left' was not declared in this scope; did you mean 'std::left'?
   15 |       left[S[j] - 'a'] = true;
      |       ^~~~
      |       std::left
/usr/include/c++/14/bits/ios_base.h:1062:3: note: 'std::left' declared here
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:18:7: error: 'right' was not declared in this scope; did you mean 'std::right'?
   18 |       right[S[j] - 'a'] = true;
      |       ^~~~~
      |       std::right
/usr/include/c++/14/bits/ios_base.h:1070:3: note: 'std::right' declared here
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:22:10: error: 'left' was not declared in this scope; did you mean 'std::left'?
   22 |       if(left[k] && right[k]) tmp++;
      |          ^~~~
      |          std::left
/usr/include/c++/14/bits/ios_base.h:1062:3: note: 'std::left' declared here
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:22:21: error: 'right' was not declared in this scope; did you mean 'std::right'?
   22 |       if(left[k] && right[k]) tmp++;
      |                     ^~~~~
      |                     std::right
/usr/include/c++/14/bits/ios_base.h:1070:3: note: 'std::right' declared here
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:24:11: error: 'max' was not declared in this scope; did you mean 'std::max'?
   24 |     ans = max(tmp, ans);
      |           ^~~
      |           std::max
In file included from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'std::max' declared here
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
a.cc:26:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   26 |   cout << ans;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~