PROGRAM ATCODER

implicit none
character(len=10**5) :: s
integer :: check,len

read(*,*) s

do
  len = len_trim(s)
  if ( trim(s) == '' ) then
    write(*,'(a)') 'YES'
    stop
  end if
  check = 0
  if ( s(len-4:len) == 'dream' .or. s(len-4:len) == 'erase' ) then
    s(len-4:len) = ''
    check = 1
  else if ( s(len-6:len) == 'dreamer' ) then
    s(len-6:len) = ''
    check = 1
  else if ( s(len-5:len) == 'eraser' ) then
    s(len-5:len) = ''
    check = 1
  end if
  if ( check == 0 ) then
    write(*,'(a)') 'NO'
    stop
  end if
end do

contains
!!!!!! サブルーチンは↓
!!!!!!

END PROGRAM ATCODER