func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     string s;     cin >> s;     char m =  b ;     int ans = 0;     int k = 0, bm = 0, rm = 0;     while (k < n) {       if (s[k] == m) {         if (m ==  b )           m =  r ;         else           m =  b ;         k++;       } else {         if (s[k] ==  b )           bm++;         else           rm++;         if (m ==  b )           m =  r ;         else           m =  b ;         k++;       }     }     int ans1 = min(bm, rm) + abs(rm - bm);     m =  r ;     k = 0, bm = 0, rm = 0;     while (k < n) {       if (s[k] == m) {         if (m ==  b )           m =  r ;         else           m =  b ;         k++;       } else {         if (s[k] ==  b )           bm++;         else           rm++;         if (m ==  b )           m =  r ;         else           m =  b ;         k++;       }     }     int ans2 = min(bm, rm) + abs(rm - bm);     cout << min(ans1, ans2) << endl;     return 0;   }   