Language: C++

#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
//max=({});


int main() {
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	for (int i = 1;i < n;++i) {
		int cnt = 0;
		for (char c = 'a';c <= 'z';++c) {
			bool left = false;
			bool right = false;
			for (int j = 0;j < i;++j) {
				if (s[j] == c) left = true;
			}
			for (int j = i;j < n;++j) {
				if (s[j] == c)right = true;
			}
			if (left && right)cnt++;
		}
		if (ans <= cnt)ans = cnt;
	}
	cout << ans << endl;
	return 0;
}
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
//max=({});


int main() {
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	for (int i = 1;i < n;++i) {
		int cnt = 0;
		for (char c = 'a';c <= 'z';++c) {
			bool left = false;
			bool right = false;
			for (int j = 0;j < i;++j) {
				if (s[j] == c) left = true;
			}
			for (int j = i;j < n;++j) {
				if (s[j] == c)right = true;
			}
			if (left && right)cnt++;
		}
		if (ans <= cnt)ans = cnt;
	}
	cout << ans << endl;
	return 0;
}
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
//max=({});


int main() {
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	for (int i = 1;i < n;++i) {
		int cnt = 0;
		for (char c = 'a';c <= 'z';++c) {
			bool left = false;
			bool right = false;
			for (int j = 0;j < i;++j) {
				if (s[j] == c) left = true;
			}
			for (int j = i;j < n;++j) {
				if (s[j] == c)right = true;
			}
			if (left && right)cnt++;
		}
		if (ans <= cnt)ans = cnt;
	}
	cout << ans << endl;
	return 0;
}
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
//max=({});


int main() {
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	for (int i = 1;i < n;++i) {
		int cnt = 0;
		for (char c = 'a';c <= 'z';++c) {
			bool left = false;
			bool right = false;
			for (int j = 0;j < i;++j) {
				if (s[j] == c) left = true;
			}
			for (int j = i;j < n;++j) {
				if (s[j] == c)right = true;
			}
			if (left && right)cnt++;
		}
		if (ans <= cnt)ans = cnt;
	}
	cout << ans << endl;
	return 0;
}
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
//max=({});


int main() {
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	for (int i = 1;i < n;++i) {
		int cnt = 0;
		for (char c = 'a';c <= 'z';++c) {
			bool left = false;
			bool right = false;
			for (int j = 0;j < i;++j) {
				if (s[j] == c) left = true;
			}
			for (int j = i;j < n;++j) {
				if (s[j] == c)right = true;
			}
			if (left && right)cnt++;
		}
		if (ans <= cnt)ans = cnt;
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc:40:5: error: redefinition of 'int main()'
   40 | int main() {
      |     ^~~~
a.cc:9:5: note: 'int main()' previously defined here
    9 | int main() {
      |     ^~~~
a.cc:71:5: error: redefinition of 'int main()'
   71 | int main() {
      |     ^~~~
a.cc:9:5: note: 'int main()' previously defined here
    9 | int main() {
      |     ^~~~
a.cc:102:5: error: redefinition of 'int main()'
  102 | int main() {
      |     ^~~~
a.cc:9:5: note: 'int main()' previously defined here
    9 | int main() {
      |     ^~~~
a.cc:133:5: error: redefinition of 'int main()'
  133 | int main() {
      |     ^~~~
a.cc:9:5: note: 'int main()' previously defined here
    9 | int main() {
      |     ^~~~