func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T1, typename T2>   istream& operator>>(istream& in, pair<T1, T2>& a) {     in >> a.first >> a.second;     return in;   }   template <typename T1, typename T2>   ostream& operator<<(ostream& out, pair<T1, T2> a) {     out << a.first <<     << a.second;     return out;   }   template <typename T, typename T1>   T maxs(T& a, T1 b) {     if (b > a) a = b;     return a;   }   template <typename T, typename T1>   T mins(T& a, T1 b) {     if (b < a) a = b;     return a;   }   const int N = 1e6 + 5;   int a[N];   int p[N];   pair<int, int> rnk[N];   int root(int first) {     if (p[first] == first) return first;     return p[first] = root(p[first]);   }   int solve() {     int n;     cin >> n;     vector<int> v(n + 1), r(n + 1);     for (int i = 1; i < n + 1; i++) {       char c;       cin >> c;       if (c ==  ? )         v[i] = -1;       else         v[i] = c - 48;     }     int j1 = n + 1;     int j2 = n + 1;     for (int i = n; i > 0; i--) {       if (v[i] == 0) {         j1 = i;       } else if (v[i] == 1) {         j2 = i;       }       a[i] = max(j1, j2) - i;       rnk[i] = {a[i], i};     }     sort(rnk + 1, rnk + 1 + n);     for (int i = 1; i <= n + 1; i++) p[i] = i;     int j = 1;     for (int i = 1; i <= n; i++) {       while (j <= n && rnk[j].first < i) {         p[rnk[j].second] = rnk[j].second + 1;         j++;       }       int cnt = 0;       int l = 1;       while (1) {         int j = root(l);         if (j > n) break;         cnt++;         l = j + i;       }       cout << cnt <<    ;     }     return 0;   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t = 1;     while (t--) {       solve();     }     return 0;   }   