func_code_string: #include <bits/stdc++.h>   using namespace std;   int dp[1001001][2];   vector<int> G[1001001];   int ans[1001001] = {};   int ma[1001001] = {};   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     string s;     cin >> s;     for (int i = 0; i < (n); ++i)       for (int j = 0; j < (2); ++j) dp[i][j] = 0;     for (int i = (n)-1; i >= 0; --i) {       if (i == n - 1) {         if (s[i] ==  0 ) {           dp[i][0] = 1;         } else if (s[i] ==  1 ) {           dp[i][1] = 1;         } else {           dp[i][0] = 1;           dp[i][1] = 1;         }       } else {         if (s[i] ==  0 ) {           dp[i][0] = dp[i + 1][0] + 1;         } else if (s[i] ==  1 ) {           dp[i][1] = dp[i + 1][1] + 1;         } else {           dp[i][0] = dp[i + 1][0] + 1;           dp[i][1] = dp[i + 1][1] + 1;         }       }       ma[i] = max(dp[i][0], dp[i][1]);       if (i > 0) {         if (s[i - 1] ==  0  && s[i] !=  0 ) {           for (int j = 0; j < (dp[i][1]); ++j) {             G[j + 1].push_back(i);           }         }         if (s[i - 1] ==  1  && s[i] !=  1 ) {           for (int j = 0; j < (dp[i][0]); ++j) {             G[j + 1].push_back(i);           }         }       }     }     set<int> se;     for (int i = 0; i < (n + 1); ++i) {       sort(G[i].begin(), G[i].end());     }     for (int i = (n + 1) - 1; i >= 0; --i) {       if (i <= 20) break;       if (i == 0) break;       int now = 0;       int ite = 0;       int m = G[i].size();       while (now < n) {         if (ma[now] >= i) {           ans[i]++;           now += i;         } else {           while (ite < m) {             if (G[i][ite] >= now) {               break;             }             ite++;           }           if (ite == m) break;           ans[i]++;           now = G[i][ite] + i;         }       }     }     for (int i = 1; i < 21; ++i) {       if (i > n) break;       int now = 0;       while (now < n) {         if (ma[now] >= i) {           ans[i]++;           now += i;         } else {           now++;         }       }     }     for (int i = 1; i < n + 1; ++i) printf( %d  , ans[i]);     cout << endl;     return 0;   }   