Language: C++

#include <bitset>
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
  string s;
  cin >> s;
  bitset b(s);
  int t=b[0];
  int ans=0;
  for (int i=1; i<b.size(); ++i) {
    if (b[i] == t) ++ans;
    t = ~t;
  }
  printf("%d", ans);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: class template argument deduction failed:
   11 |   bitset b(s);
      |             ^
a.cc:11:13: error: no matching function for call to 'bitset(std::string&)'
In file included from a.cc:1:
/usr/include/c++/14/bitset:1020:9: note: candidate: 'template<long unsigned int _Nb, class _CharT> bitset(const _CharT*, typename std::__bitset::__string<_CharT>::size_type, _CharT, _CharT)-> std::bitset<_Nb>'
 1020 |         bitset(const _CharT* __str,
      |         ^~~~~~
/usr/include/c++/14/bitset:1020:9: note:   template argument deduction/substitution failed:
a.cc:11:13: note:   mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
   11 |   bitset b(s);
      |             ^
/usr/include/c++/14/bitset:996:9: note: candidate: 'template<long unsigned int _Nb, class _CharT, class _Traits, class _Alloc> bitset(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::size_t, std::size_t, _CharT, _CharT)-> std::bitset<_Nb>'
  996 |         bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s,
      |         ^~~~~~
/usr/include/c++/14/bitset:996:9: note:   candidate expects 4 arguments, 1 provided
/usr/include/c++/14/bitset:984:9: note: candidate: 'template<long unsigned int _Nb, class _CharT, class _Traits, class _Alloc> bitset(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::size_t, std::size_t)-> std::bitset<_Nb>'
  984 |         bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s,
      |         ^~~~~~
/usr/include/c++/14/bitset:984:9: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bitset:962:9: note: candidate: 'template<long unsigned int _Nb, class _CharT, class _Traits, class _Alloc> bitset(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::size_t)-> std::bitset<_Nb>'
  962 |         bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s,
      |         ^~~~~~
/usr/include/c++/14/bitset:962:9: note:   template argument deduction/substitution failed:
a.cc:11:13: note:   couldn't deduce template parameter '_Nb'
   11 |   bitset b(s);
      |             ^
/usr/include/c++/14/bitset:941:17: note: candidate: 'template<long unsigned int _Nb> bitset(long long unsigned int)-> std::bitset<_Nb>'
  941 |       constexpr bitset(unsigned long long __val) noexcept
      |                 ^~~~~~
/usr/include/c++/14/bitset:941:17: note:   template argument deduction/substitution failed:
a.cc:11:13: note:   couldn't deduce template parameter '_Nb'
   11 |   bitset b(s);
      |             ^
/usr/include/c++/14/bitset:936:26: note: candidate: 'template<long unsigned int _Nb> bitset()-> std::bitset<_Nb>'
  936 |       _GLIBCXX_CONSTEXPR bitset() _GLIBCXX_NOEXCEPT
      |                          ^~~~~~
/usr/include/c++/14/bitset:936:26: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bitset:804:11: note: candidate: 'template<long unsigned int _Nb> bitset(std::bitset<_Nb>)-> std::bitset<_Nb>'
  804 |     class bitset
      |           ^~~~~~
/usr/include/c++/14/bitset:804:11: note:   template argument deduction/substitution failed:
a.cc:11:13: note:   'std::__cxx11::basic_string<char>' is not derived from 'std::bitset<_Nb>'
   11 |   bitset b(s);
      |             ^