Language: C++

#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 500000
ll MOD=1e9+7;

int change(vec v){
    int ret=0,bi=1;
    rep(i,26){
        ret+=v[i]*bi;
        bi*=2;
    }
    return ret;
}
main(){
    string ss;cin>>ss;
    int n=ss.size();
    vec dp(n+2,INF);
    vec s;
    rep(i,n){
        s.pb((int)(ss[i]-'a'));
    }
    map<vec,int> m;
    vec counter(26);
    rep2(i,1,n){
        counter[s[i-1]]^=1;
        m[change(counter)]=i;
    }
    int flag=1;
    rep(i,26)flag-=counter[i];
    if(flag>=0){
        cout<<1<<endl;return 0;
    }
    counter=vec(26);
    dp[0]=0;
    rep(i,n+1){
        rep(j,26){
            vec temp=counter;
            temp[j]^=1;
            int place=change(temp);
            dp[place]=min(dp[place],dp[i]+1);
        }
        if(i<n)
        counter[s[i]]^=1;
    }
    cout<<dp[n]<<endl;
    return 0;
}



Compiler output:
a.cc:56:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   56 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:68:10: error: no match for 'operator[]' (operand types are 'std::map<std::vector<int>, int>' and 'int')
   68 |         m[change(counter)]=i;
      |          ^
In file included from /usr/include/c++/14/map:63,
                 from a.cc:11:
/usr/include/c++/14/bits/stl_map.h:504:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::vector<int>; _Tp = int; _Compare = std::less<std::vector<int> >; _Alloc = std::allocator<std::pair<const std::vector<int>, int> >; mapped_type = int; key_type = std::vector<int>]'
  504 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:504:34: note:   no known conversion for argument 1 from 'int' to 'const std::map<std::vector<int>, int>::key_type&' {aka 'const std::vector<int>&'}
  504 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_map.h:524:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](key_type&&) [with _Key = std::vector<int>; _Tp = int; _Compare = std::less<std::vector<int> >; _Alloc = std::allocator<std::pair<const std::vector<int>, int> >; mapped_type = int; key_type = std::vector<int>]'
  524 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:524:29: note:   no known conversion for argument 1 from 'int' to 'std::map<std::vector<int>, int>::key_type&&' {aka 'std::vector<int>&&'}
  524 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~