func_code_string: #include <bits/stdc++.h>   using namespace std;   int a[500010];   int main() {     int n;     cin >> n;     a[0] = 2;     vector<pair<int, int> > cumcnt;     for (int i = 1; i <= n; ++i) {       cin >> a[i];       if (a[i] == a[i - 1])         cumcnt.back().second++;       else         cumcnt.emplace_back(a[i], 1);     }     cumcnt.back().second++;     int N = (int(cumcnt.size()));     int st = 0;     int ans = 0;     for (int i = 0; i < N; i++) {       if (i == N - 1) break;       st += cumcnt[i].second;       int j = i + 1, e = 0;       while (j < N && cumcnt[j].second == 1) j++, e++;       if (j < N) {         int steps = (e + 1) / 2;         ans = max(ans, steps);         for (int make_pair = 0; make_pair < e; ++make_pair) {           if (cumcnt[i].first == cumcnt[j].first)             a[make_pair + st + 1] = cumcnt[i].first;           else {             if (make_pair < e / 2)               a[make_pair + st + 1] = cumcnt[i].first;             else               a[make_pair + st + 1] = cumcnt[j].first;           }         }       }       st += e;       i = j - 1;     }     cout << ans <<   n ;     for (int i = 1; i <= n; ++i) {       cout << a[i] <<    n [i == n];     }     return 0;   }   