program test
implicit none
integer::l
character::S*100000
read(*,*)S
l=len_trim(S)
do 
	if(l==0)then
    print*,'YES'
    stop
	else if(S(l-4:l)=='dream')then
    	l=l-5
   	else if(S(l-6:l)=='dreamer')then
    	l=l-7
    else if(S(l-4:l)=='erase')then
    	l=l-5
    else if(S(l-5:l)=='eraser')then
    	l=l-6
    else 
    	print*,'NO'
        stop
    end if
end do
end program test

