Language: C++

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

int main(void){
    string s;
    cin >> s;
    int ans=0;
    stack<int> qube(s.size(),0));
    for(int i=1;i<s.size();i++)
    {
        qube.push(s[i]);
        if((s[i]=='0'&&s[i-1]=='1')||s[i]=='1'&&s[i-1]=='0')
        {
            qube.pop();
            qube.pop();
            ans+=2;
        }
    }

    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:31: error: no matching function for call to 'std::stack<int>::stack(std::__cxx11::basic_string<char>::size_type, int)'
    8 |     stack<int> qube(s.size(),0));
      |                               ^
In file included from /usr/include/c++/14/stack:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:160,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_stack.h:199:9: note: candidate: 'template<class _Alloc, class _Requires> std::stack<_Tp, _Sequence>::stack(std::stack<_Tp, _Sequence>&&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  199 |         stack(stack&& __q, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_stack.h:199:9: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_stack.h: In substitution of 'template<class _Tp, class _Sequence> template<class _Alloc> using std::stack<_Tp, _Sequence>::_Uses = typename std::enable_if<std::uses_allocator<_Sequence, _Alloc>::value>::type [with _Alloc = int; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]':
/usr/include/c++/14/bits/stl_stack.h:198:33:   required from here
  198 |       template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
      |                                 ^~~~~~~~
/usr/include/c++/14/bits/stl_stack.h:127:15: error: no type named 'type' in 'struct std::enable_if<false, void>'
  127 |         using _Uses = typename
      |               ^~~~~
/usr/include/c++/14/bits/stl_stack.h:195:9: note: candidate: 'template<class _Alloc, class _Requires> std::stack<_Tp, _Sequence>::stack(const std::stack<_Tp, _Sequence>&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  195 |         stack(const stack& __q, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_stack.h:195:9: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_stack.h:191:9: note: candidate: 'template<class _Alloc, class _Requires> std::stack<_Tp, _Sequence>::stack(_Sequence&&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  191 |         stack(_Sequence&& __c, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_stack.h:191:9: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_stack.h:187:9: note: candidate: 'template<class _Alloc, class _Requires> std::stack<_Tp, _Sequence>::stack(const _Sequence&, const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  187 |         stack(const _Sequence& __c, const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_stack.h:187:9: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_stack.h:183:9: note: candidate: 'template<class _Alloc, class _Requires> std::stack<_Tp, _Sequence>::stack(const _Alloc&) [with _Requires = _Alloc; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  183 |         stack(const _Alloc& __a)
      |         ^~~~~
/usr/include/c++/14/bits/stl_stack.h:183:9: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_stack.h:162:9: note: candidate: 'template<class _Seq, class _Requires> std::stack<_Tp, _Sequence>::stack() [with _Requires = _Seq; _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  162 |         stack()
      |         ^~~~~
/usr/include/c++/14/bits/stl_stack.h:162:9: note:   candidate expects 0 arguments, 2 provided
/usr/include/c++/14/bits/stl_stack.h:170:7: note: candidate: 'std::stack<_Tp, _Sequence>::stack(_Sequence&&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  170 |       stack(_Sequence&& __c)
      |       ^~~~~
/usr/include/c++/14/bits/stl_stack.h:170:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_stack.h:166:7: note: candidate: 'std::stack<_Tp, _Sequence>::stack(const _Sequence&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
  166 |       stack(const _Sequence& __c)
      |       ^~~~~
/usr/include/c++/14/bits/stl_stack.h:166:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_stack.h:99:11: note: candidate: 'std::stack<int>::stack(const std::stack<int>&)'
   99 |     class stack
      |           ^~~~~
/usr/include/c++/14/bits/stl_stack.h:99:11: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_stack.h:99:11: note: candidate: 'std::stack<int>::stack(std::stack<int>&&)'
/usr/include/c++/14/bits/stl_stack.h:99:11: note:   candidate expects 1 argument, 2 provided
a.cc:8:32: error: expected ',' or ';' before ')' token
    8 |     stack<int> qube(s.size(),0));
      |                                ^