#include <stdio.h>
#include <string.h>
void rev(char *s){
	int l=strlen(s),i;
	for(i=0;i<l/2;i++){
		char t=s[i];
		s[i]=s[l-1-i];
		s[l-1-i]=t;
	}
}
char T[4][8]={"dream","dreamer","erase","eraser"};
int main(){
	int i=0,c,l;
	char s[100001];
	for(i=0;i<4;i++)rev(T[i]);
	scanf("%s",s);
	l=strlen(s);
	rev(s);
	for(;c<l;){
		int k=-1;
		for(i=0;i<4;i++){
			if(!strncmp(s+c,T[i],strlen(T[i]))){
				k=strlen(T[i]);
				break;
			}
		}
		if(k<0){
			puts("NO");
			return 0;
		}
		c+=k;
	}
	puts("YES");
	return 0;
}

; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/ObjectiveC/Source_866/source.m'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/ObjectiveC/Source_866/source.m"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@T = dso_local global [4 x [8 x i8]] [[8 x i8] c"dream\00\00\00", [8 x i8] c"dreamer\00", [8 x i8] c"erase\00\00\00", [8 x i8] c"eraser\00\00"], align 16
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"YES\00", align 1

; Function Attrs: minsize nofree nounwind optsize memory(argmem: readwrite) uwtable
define dso_local void @rev(ptr nocapture noundef %s) local_unnamed_addr #0 {
entry:
  %call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
  %conv = trunc i64 %call to i32
  %div = sdiv i32 %conv, 2
  %smax = tail call i32 @llvm.smax.i32(i32 %div, i32 0)
  %wide.trip.count = zext i32 %smax to i64
  br label %for.cond

for.cond:                                         ; preds = %for.body, %entry
  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
  %exitcond.not = icmp eq i64 %indvars.iv, %wide.trip.count
  br i1 %exitcond.not, label %for.end, label %for.body

for.body:                                         ; preds = %for.cond
  %arrayidx = getelementptr inbounds i8, ptr %s, i64 %indvars.iv
  %0 = load i8, ptr %arrayidx, align 1, !tbaa !5
  %1 = xor i64 %indvars.iv, -1
  %sub2 = add i64 %call, %1
  %sext = shl i64 %sub2, 32
  %idxprom3 = ashr exact i64 %sext, 32
  %arrayidx4 = getelementptr inbounds i8, ptr %s, i64 %idxprom3
  %2 = load i8, ptr %arrayidx4, align 1, !tbaa !5
  store i8 %2, ptr %arrayidx, align 1, !tbaa !5
  store i8 %0, ptr %arrayidx4, align 1, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  br label %for.cond

for.end:                                          ; preds = %for.cond
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: minsize mustprogress nofree nounwind optsize willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: minsize nofree nounwind optsize uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
  %s = alloca [100001 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 100001, ptr nonnull %s) #7
  br label %for.cond

for.cond:                                         ; preds = %for.body, %entry
  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
  %exitcond.not = icmp eq i64 %indvars.iv, 4
  br i1 %exitcond.not, label %cleanup37, label %for.body

for.body:                                         ; preds = %for.cond
  %arrayidx = getelementptr inbounds [4 x [8 x i8]], ptr @T, i64 0, i64 %indvars.iv
  tail call void @rev(ptr noundef nonnull %arrayidx) #8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  br label %for.cond

cleanup37:                                        ; preds = %for.cond
  %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) #8
  call void @rev(ptr noundef nonnull %s) #8
  %call36 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2) #8
  call void @llvm.lifetime.end.p0(i64 100001, ptr nonnull %s) #7
  ret i32 0
}

; Function Attrs: minsize nofree nounwind optsize
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4

; Function Attrs: minsize nofree nounwind optsize
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5

attributes #0 = { minsize nofree nounwind optsize memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { minsize mustprogress nofree nounwind optsize willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { minsize nofree nounwind optsize uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { minsize nofree nounwind optsize "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { minsize nounwind optsize willreturn memory(read) }
attributes #7 = { nounwind }
attributes #8 = { minsize optsize }

!llvm.linker.options = !{}
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
