#include<bits/stdc++.h>
using namespace std;
	string s;
	vector<string> words={"dream","dreamer","erase","eraser"};
	int num;
bool dfs(int i){
	bool ret=false;
	if(i==num)return true;
	for(auto&& w:words){
		if(i+w.size()<=num && s.substr(i,w.size())==w){
		ret=ret or dfs(i+w.size());
		}
	}	
	return ret;

	}


int main(){
	cin >>s;
	num=s.size();
	cout<<(dfs(0)?"YES":"NO")<<endl;

}