About
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define u_ll unsigned ll
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
using namespace std;
#define MAXN 210000
#define MOD 1000000007
#define INF 100000000000000000ll
typedef tree<ll, null_type, less_equal<ll>,
rb_tree_tag, tree_order_statistics_node_update>
TREE;
ll bpow(ll b, ll e);
ll res(ll a, ll b) { return ((a % MOD) - (b % MOD)) % MOD; }
ll sum(ll a, ll b) { return ((a % MOD) + (b % MOD)) % MOD; }
ll mult(ll a, ll b) { return ((a % MOD) * (b % MOD)) % MOD; }
ll invmod(ll a) { return bpow(a, MOD - 2); }
ll divmod(ll a, ll b){ return mult(a,invmod(b)); }
ll bpow(ll b, ll e)
{
ll rets[3] = {1,b,mult(b,b)};
if(e < 3)return rets[e];
ll t = bpow(b,e/2);
t = mult(t,t);
if(e&1)
t = mult(t,b);
return t;
}
int n,c;
vector<vector<pair<ll,ll>>> g;
ll dfs(int x,int p = -1) {
bool ok = 0;
ll mn = 0;
for(auto to: g[x]){
if(to.first == p)continue;
mn += min(to.second,dfs(to.first,x));
ok = 1;
}
if(ok == 0){
mn=MAXN;
}
//cerr << (x+1) << " " << mn << " " << mx << endl;
return mn;
}
signed main()
{
int n;
cin >> n ;
string s;
cin >> s;
vector<int> dp(28);
vector<int> dp2(28);
for(int i = 0 ; i < n; i++){
dp[s[i]-'a']++;
}
ll mx = 0;
for(int i = n-1; i >= 0; i--){
dp[s[i]-'a']--;
dp2[s[i]-'a']++;
ll cnt = 0;
for(int i = 0; i < 28; i++){
if(dp[i] > 0 && dp2[i] > 0){
cnt++;
}
}
mx = max(mx,cnt);
}
cout << mx << endl;
}
Sun
|
Mon
|
Tues
|
Wed
|
Thurs
|
Fri
|
Sat
|