Language: C++


 //In The Name Of GOD
 
#include <bits/stdc++.h>

using namespace std;

typedef long long ll ;

const int mod = 1000000007;
const int inf = 2000000000;
const int maxn = 500*1000+500*1000+15;
const int MLOG = 18;

#define pb push_back
#define pp pop_back
#define X first
#define Y second
#define IO ios_base::sync_with_stdio(false);
#define sz(a) (int)(a.size())

vector<char> vec;

void faz1(vector<char> &vec){
	if ( vec.back() == 'd' ){
		if( sz(vec) >= 5 ){
		 	if( vec[sz(vec) - 2] == 'r' && vec[sz(vec) - 3] == 'e' && vec[sz(vec) - 4] == 'a' && vec[sz(vec) - 5] == 'm'){
				for(int i = 0;i < 5 ; i++)
					vec.pp();
			}else{
				cout << "NO";
				exit(0);
			}
		}else{
			cout << "NO";
			exit(0);
		}
	}else if( vec.back() == 'e' ){
		if( sz(vec) >= 5 ){
		 	if( vec[sz(vec) - 2] == 'r' && vec[sz(vec) - 3] == 'a' && vec[sz(vec) - 4] == 's' && vec[sz(vec) - 5] == 'e'){
				for(int i = 0;i < 5 ; i++)
					vec.pp();
			}else{
				cout << "NO";
				exit(0);
			}
		}else{
			cout << "NO";
			exit(0);
		}
	}else{
		cout<< "NO";
		exit(0);
	}
}

void faz3(vector<char> &vec){
	if( sz(vec) == 0 )
		return ;
	if ( vec[sz(vec)-1] == 'r'){
		vec.pp();	
	}else{
		return ;
	}
}


void faz2(vector<char> &vec){
	if( sz(vec) == 0 )
		return ;
	if( sz(vec) == 1 ){
		cout << "NO";
		exit(0);
		return ;
	}
	if ( vec.back() == 'e' && vec[sz(vec)-2] == 'r'){
		
	}else{
		cout<<"NO";
		exit(0);
	}
	if(sz(vec) == 2){vec.pp();vec.pp();return ;}
	if(vec[sz(vec) - 3] == 'a'){
		return;
	}
	vec.pp();
	vec.pp();
	return ;
}
int main(){
	string s;
    cin >> s;
    reverse(s.begin,  s.end());
    int i=0;
    string ss[4]={"dream","dreamer","erase","eraser"};
    for(int i = 0; i < 4; i++){ 
        reverse(ALL(ss[i]));
    }
    string t = "";
    while(i < s.size()){
        t += s[i];
        for(int i = 0; i < 4; i++){
            if(ss[i] == t){
                t="";
            }
        }
        i++;
    }
    if(tmp==""){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:93:12: error: no matching function for call to 'reverse(<unresolved overloaded function type>, std::__cxx11::basic_string<char>::iterator)'
   93 |     reverse(s.begin,  s.end());
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'void std::reverse(_BIter, _BIter) [with _BIter = __gnu_cxx::__normal_iterator<char*, __cxx11::basic_string<char> >]'
 1083 |     reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
      |     ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:36: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >'
 1083 |     reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
      |             ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
  249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
      | ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note:   candidate expects 3 arguments, 2 provided
a.cc:97:17: error: 'ALL' was not declared in this scope
   97 |         reverse(ALL(ss[i]));
      |                 ^~~
a.cc:109:8: error: 'tmp' was not declared in this scope; did you mean 'tm'?
  109 |     if(tmp==""){
      |        ^~~
      |        tm