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(), [&s, &t]() { return s.back() == t.back(); s.pop_back(); t.pop.back(); }) << endl;;
  
    return 0;
}


Compiler output:
a.cc: In lambda function:
a.cc:12:106: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pop'
   12 |         cout << count_if(s.rbegin(), s.rend(), [&s, &t]() { return s.back() == t.back(); s.pop_back(); t.pop.back(); }) << endl;;
      |                                                                                                          ^~~
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(), [&s, &t]() { 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(), [&s, &t]() { return s.back() == t.back(); s.pop_back(); t.pop.back(); }) << endl;;
      |                                                ^
a.cc:12:48: note:   candidate expects 0 arguments, 1 provided