Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string s;
  int i,count = 0;
  cin >>s;
  s = s + "2";
  for(i=0;i<s.size();i++){
    if(atoi(s[i]) == 2 || atoi(s[i+1]) == 2)break;
    if(atoi(s[i]) == 1 && atoi(s[i+1]) == 0){
      s.erase(i,2);
      i -= 2;
      count += 2;
    }else if(atoi(s[i]) == 0 && atoi(s[i+1]) == 1){
      s.erase(i,2);
      i -= 2;
      count += 2;
    }
  }
  cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:12: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
   10 |     if(atoi(s[i]) == 2 || atoi(s[i+1]) == 2)break;
      |        ~~~~^~~~~~
      |            |
      |            __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
a.cc:10:31: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
   10 |     if(atoi(s[i]) == 2 || atoi(s[i+1]) == 2)break;
      |                           ~~~~^~~~~~~~
      |                               |
      |                               __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
a.cc:11:12: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
   11 |     if(atoi(s[i]) == 1 && atoi(s[i+1]) == 0){
      |        ~~~~^~~~~~
      |            |
      |            __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
a.cc:11:31: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
   11 |     if(atoi(s[i]) == 1 && atoi(s[i+1]) == 0){
      |                           ~~~~^~~~~~~~
      |                               |
      |                               __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
a.cc:15:18: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
   15 |     }else if(atoi(s[i]) == 0 && atoi(s[i+1]) == 1){
      |              ~~~~^~~~~~
      |                  |
      |                  __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
a.cc:15:37: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
   15 |     }else if(atoi(s[i]) == 0 && atoi(s[i+1]) == 1){
      |                                 ~~~~^~~~~~~~
      |                                     |
      |                                     __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~