Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int S;
  cin >>S;
  int N=S.size;
  int count;
  for(int i=0;i<(N-1);i++){
    if(i=N-2){
      if(S.at(N-2)==S.at(N-1)){
        if(S.at(N-1)==1)
          S.at(N-1)=0;
        if(S.at(N-1)==0)
          S.at(N-1)=1;
        count++;
      }
    }
    else{
      if(S.at(i)==S.at(i+1)){
        if(S.at(i+1)==S.at(i+2)){
          if(S.at(i+1)==1){
            S.at(i+1)=0;
          }
          if(S.at(i+1)==0){
            S.at(i+1)=1;
          }
          i=-1;
          count++;
        }
        else{
          if(S.at(i)==1)
            S.at(i)=0;
          if(S.at(i)==0)
            S.at(i)=1;
          i=-1;
          count++
        }
      }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:11: error: request for member 'size' in 'S', which is of non-class type 'int'
    7 |   int N=S.size;
      |           ^~~~
a.cc:11:12: error: request for member 'at' in 'S', which is of non-class type 'int'
   11 |       if(S.at(N-2)==S.at(N-1)){
      |            ^~
a.cc:11:23: error: request for member 'at' in 'S', which is of non-class type 'int'
   11 |       if(S.at(N-2)==S.at(N-1)){
      |                       ^~
a.cc:12:14: error: request for member 'at' in 'S', which is of non-class type 'int'
   12 |         if(S.at(N-1)==1)
      |              ^~
a.cc:13:13: error: request for member 'at' in 'S', which is of non-class type 'int'
   13 |           S.at(N-1)=0;
      |             ^~
a.cc:14:14: error: request for member 'at' in 'S', which is of non-class type 'int'
   14 |         if(S.at(N-1)==0)
      |              ^~
a.cc:15:13: error: request for member 'at' in 'S', which is of non-class type 'int'
   15 |           S.at(N-1)=1;
      |             ^~
a.cc:20:12: error: request for member 'at' in 'S', which is of non-class type 'int'
   20 |       if(S.at(i)==S.at(i+1)){
      |            ^~
a.cc:20:21: error: request for member 'at' in 'S', which is of non-class type 'int'
   20 |       if(S.at(i)==S.at(i+1)){
      |                     ^~
a.cc:21:14: error: request for member 'at' in 'S', which is of non-class type 'int'
   21 |         if(S.at(i+1)==S.at(i+2)){
      |              ^~
a.cc:21:25: error: request for member 'at' in 'S', which is of non-class type 'int'
   21 |         if(S.at(i+1)==S.at(i+2)){
      |                         ^~
a.cc:22:16: error: request for member 'at' in 'S', which is of non-class type 'int'
   22 |           if(S.at(i+1)==1){
      |                ^~
a.cc:23:15: error: request for member 'at' in 'S', which is of non-class type 'int'
   23 |             S.at(i+1)=0;
      |               ^~
a.cc:25:16: error: request for member 'at' in 'S', which is of non-class type 'int'
   25 |           if(S.at(i+1)==0){
      |                ^~
a.cc:26:15: error: request for member 'at' in 'S', which is of non-class type 'int'
   26 |             S.at(i+1)=1;
      |               ^~
a.cc:32:16: error: request for member 'at' in 'S', which is of non-class type 'int'
   32 |           if(S.at(i)==1)
      |                ^~
a.cc:33:15: error: request for member 'at' in 'S', which is of non-class type 'int'
   33 |             S.at(i)=0;
      |               ^~
a.cc:34:16: error: request for member 'at' in 'S', which is of non-class type 'int'
   34 |           if(S.at(i)==0)
      |                ^~
a.cc:35:15: error: request for member 'at' in 'S', which is of non-class type 'int'
   35 |             S.at(i)=1;
      |               ^~
a.cc:37:18: error: expected ';' before '}' token
   37 |           count++
      |                  ^
      |                  ;
   38 |         }
      |         ~         
a.cc:41:2: error: expected '}' at end of input
   41 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^