#include<cstdio>

using namespace std;

char s[100002];
bool f[100002];
char z[4][10]={"dream","dreamer","erase","eraser"};
int main(){
	scanf("%s",s+1);
	int n=0;
	for(;s[n+1];n++);
	f[n+1]=1;
	for(int i=n;i;i--)
		for(int j=0,k;j<4;j++){
			for(k=0;z[j][k];k++)
				if(s[i+k]!=z[j][k])goto ed;
			f[i]|=f[i+k];
			ed:;
		}
	printf(f[1]?"YES":"NO");
}