Language: C++

#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
ll mod=1000000007;
bool isok=false;
string s;
vector<string> v{ "dream", "dreamer", "erase", "eraser"};

void rec(int pos){
  if(pos==s.size()) isok=true;
  for(int i=0;i<4;++i){
    auto newpos = s.find(v[i],pos,v[i].size());
    if(newpos == pos){
      rec(pos+v[i].size());
    }
  }
}


int main() {
  cin >> s;
  rec(0);
  if(isok) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'void rec(int)':
a.cc:13:25: error: no matching function for call to 'std::__cxx11::basic_string<char>::find(__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type&, int&, std::__cxx11::basic_string<char>::size_type)'
   13 |     auto newpos = s.find(v[i],pos,v[i].size());
      |                   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:2720:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, typename __gnu_cxx::__alloc_traits<typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_CharT>::other>::size_type> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(const _Tp&, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 2720 |         find(const _Tp& __svt, size_type __pos = 0) const
      |         ^~~~
/usr/include/c++/14/bits/basic_string.h:2720:9: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/basic_string.h:2691:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(const _CharT*, size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 2691 |       find(const _CharT* __s, size_type __pos, size_type __n) const
      |       ^~~~
/usr/include/c++/14/bits/basic_string.h:2691:26: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
 2691 |       find(const _CharT* __s, size_type __pos, size_type __n) const
      |            ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:2706:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 2706 |       find(const basic_string& __str, size_type __pos = 0) const
      |       ^~~~
/usr/include/c++/14/bits/basic_string.h:2706:7: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/basic_string.h:2740:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(const _CharT*, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 2740 |       find(const _CharT* __s, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
      |       ^~~~
/usr/include/c++/14/bits/basic_string.h:2740:7: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/basic_string.h:2758:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(_CharT, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 2758 |       find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
      |       ^~~~
/usr/include/c++/14/bits/basic_string.h:2758:7: note:   candidate expects 2 arguments, 3 provided