func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 500001;   int a[maxn][2];   int cur, n;   int r[maxn][2], tot;   void dosth() {     int i;     a[1][cur ^ 1] = a[1][cur];     a[n][cur ^ 1] = a[n][cur];     for (i = 2; i < n; ++i)       a[i][cur ^ 1] = a[i - 1][cur] + a[i][cur] + a[i + 1][cur] > 1 ? 1 : 0;     cur ^= 1;   }   int count() {     int f = !a[1][0], i, j, ans = 0, tmp = 1;     a[0][0] = a[1][0];     for (i = 2; i <= n; ++i) {       if (a[i][0] != ((i + f) & 1)) {         if (1) {           for (j = 1; j <= tmp / 2; ++j) a[i - j][0] = a[i][0];           for (j = tmp / 2 + 1; j <= tmp; ++j) a[i - j][0] = a[i - tmp - 1][0];         }         ans = max(ans, tmp), tmp = 1, f ^= 1;       } else         tmp++;     }     for (j = 1; j <= tmp / 2; ++j) a[i - j][0] = a[n][0];     for (j = tmp / 2 + 1; j <= tmp; ++j) a[i - j][0] = a[i - tmp - 1][0];     return (max(ans, tmp) - 1) / 2;   }   int main() {     scanf( %d , &n);     int i, j;     cur = 0;     for (i = 1; i <= n; ++i) {       char c;       do c = getchar();       while (!isdigit(c));       a[i][0] = c - 48;     }     printf( %d n , count());     for (i = 1; i <= n; ++i) putchar(a[i][0] +  0 ), putchar(   );     putchar(  n );     return 0;   }   