func_code_string: #include <bits/stdc++.h>   using namespace std;   const int inv = numeric_limits<int>::max();   const int minv = numeric_limits<int>::min();   const int max_n = 500010;   int n;   int a[max_n];   int b[max_n] = {0};   int main() {     scanf( %d , &n);     for (int i = 0; i < n; ++i) scanf( %d , &a[i]);     int c = 0;     for (int i = n - 2; i >= 0; --i) {       if (i > 0 and a[i - 1] != a[i] and a[i] != a[i + 1])         ++c;       else {         b[i + 1] = c;         c = 0;       }     }     int res = 0;     for (int i = 1; i <= n - 2; ++i)       if (b[i] > 0) {         res = max(res, (b[i] + 1) / 2);         if (b[i] & 1)           for (int j = i; j < i + b[i]; ++j) a[j] = a[i - 1];         else {           for (int j = i; j < i + b[i] / 2; ++j) a[j] = a[i - 1];           for (int j = i + b[i] / 2; j < i + b[i]; ++j) a[j] = a[i + b[i]];         }       }     printf( %d n , res);     for (int i = 0; i < n; ++i) printf( %d  , a[i]);     printf(  n );     return 0;   }   