func_code_string: #include <bits/stdc++.h>   using namespace std;   int N;   char S[1010];   int E[1010], F[1010][2];   int main() {     scanf( %d , &N);     scanf( %s , S);     memset(E, 0, sizeof(E));     for (int i = 0; i < N; i++) {       E[i + 1] = S[i] -  0 ;       F[i + 1][0] = F[i + 1][1] = 0x3f3f3f3f;     }     F[0][0] = F[0][1] = 0;     for (int i = 1; i <= N; i++)       for (int j = 0; j < 2; j++) {         if (E[i] == j) {           F[i][j] = min(F[i][j], F[i - 1][1 - j]);         } else if (E[i] == 1 - j) {           F[i][j] = min(F[i][j], F[i - 1][E[i]] + 1);         }         if (i - 2 >= 0) {           if (E[i] == E[i - 1]) {             F[i][j] = min(F[i][j], F[i - 2][j] + 1);           } else if (E[i] != E[i - 1]) {             if (E[i] == j)               F[i][j] = min(F[i][j], F[i - 2][j]);             else if (E[i] != j)               F[i][j] = min(F[i][j], F[i - 2][j] + 2);           }         }       }     int ans = min(F[N][0], F[N][1]);     if (ans == 0x3f3f3f3f) ans = -1;     cout << ans << endl;     return 0;   }   