Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
    string s, t;
  	cin >> s;
  	cin >> t;
  
  	cout << count_if(s.rbegin(), s.rend(), []() { return s.back() == t.back(); s.pop_back(); t.pop.back(); }) << endl;;
  
    return 0;
}


Compiler output:
a.cc: In lambda function:
a.cc:12:62: error: 's' is not captured
   12 |         cout << count_if(s.rbegin(), s.rend(), []() { return s.back() == t.back(); s.pop_back(); t.pop.back(); }) << endl;;
      |                                                              ^
a.cc:12:49: note: the lambda has no capture-default
   12 |         cout << count_if(s.rbegin(), s.rend(), []() { return s.back() == t.back(); s.pop_back(); t.pop.back(); }) << endl;;
      |                                                 ^
a.cc:8:12: note: 'std::string s' declared here
    8 |     string s, t;
      |            ^
a.cc:12:74: error: 't' is not captured
   12 |         cout << count_if(s.rbegin(), s.rend(), []() { return s.back() == t.back(); s.pop_back(); t.pop.back(); }) << endl;;
      |                                                                          ^
a.cc:12:49: note: the lambda has no capture-default
   12 |         cout << count_if(s.rbegin(), s.rend(), []() { return s.back() == t.back(); s.pop_back(); t.pop.back(); }) << endl;;
      |                                                 ^
a.cc:8:15: note: 'std::string t' declared here
    8 |     string s, t;
      |               ^
a.cc:12:84: error: 's' is not captured
   12 |         cout << count_if(s.rbegin(), s.rend(), []() { return s.back() == t.back(); s.pop_back(); t.pop.back(); }) << endl;;
      |                                                                                    ^
a.cc:12:49: note: the lambda has no capture-default
   12 |         cout << count_if(s.rbegin(), s.rend(), []() { return s.back() == t.back(); s.pop_back(); t.pop.back(); }) << endl;;
      |                                                 ^
a.cc:8:12: note: 'std::string s' declared here
    8 |     string s, t;
      |            ^
a.cc:12:98: error: 't' is not captured
   12 |         cout << count_if(s.rbegin(), s.rend(), []() { return s.back() == t.back(); s.pop_back(); t.pop.back(); }) << endl;;
      |                                                                                                  ^
a.cc:12:49: note: the lambda has no capture-default
   12 |         cout << count_if(s.rbegin(), s.rend(), []() { return s.back() == t.back(); s.pop_back(); t.pop.back(); }) << endl;;
      |                                                 ^
a.cc:8:15: note: 'std::string t' declared here
    8 |     string s, t;
      |               ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
                 from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_pred<_Predicate>::operator()(_Iterator) [with _Iterator = std::reverse_iterator<__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> > >; _Predicate = main()::<lambda()>]':
/usr/include/c++/14/bits/stl_algobase.h:2163:12:   required from 'typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::__count_if(_InputIterator, _InputIterator, _Predicate) [with _InputIterator = reverse_iterator<__gnu_cxx::__normal_iterator<char*, __cxx11::basic_string<char> > >; _Predicate = __gnu_cxx::__ops::_Iter_pred<main()::<lambda()> >; typename iterator_traits< <template-parameter-1-1> >::difference_type = long int]'
 2163 |         if (__pred(__first))
      |             ~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4057:29:   required from 'typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count_if(_IIter, _IIter, _Predicate) [with _IIter = reverse_iterator<__gnu_cxx::__normal_iterator<char*, __cxx11::basic_string<char> > >; _Predicate = main()::<lambda()>; typename iterator_traits< <template-parameter-1-1> >::difference_type = long int]'
 4057 |       return std::__count_if(__first, __last,
      |              ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
 4058 |                              __gnu_cxx::__ops::__pred_iter(__pred));
      |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:12:20:   required from here
   12 |         cout << count_if(s.rbegin(), s.rend(), []() { return s.back() == t.back(); s.pop_back(); t.pop.back(); }) << endl;;
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:318:30: error: no match for call to '(main()::<lambda()>) (char&)'
  318 |         { return bool(_M_pred(*__it)); }
      |                       ~~~~~~~^~~~~~~
a.cc:12:48: note: candidate: 'main()::<lambda()>'
   12 |         cout << count_if(s.rbegin(), s.rend(), []() { return s.back() == t.back(); s.pop_back(); t.pop.back(); }) << endl;;
      |                                                ^
a.cc:12:48: note:   candidate expects 0 arguments, 1 provided