      PROGRAM daydream
      IMPLICIT NONE
      CHARACTER (10**5):: s
      INTEGER :: index,Ls(4),N,i
      LOGICAL :: flag
      CHARACTER(7) :: a(4)
      
      READ*,s
      
      a = (/'dream  ','dreamer','erase  ','eraser '/)
      Ls = (/5,7,5,6/)
      
      
      N = len_trim( s )
      
      index = 1
      outer:DO while(.TRUE.)
        inner:DO i = 1,4
          IF(index+Ls(i)-1<=N)THEN
            IF( trim(a(i))==trim(s(index:index+Ls(i)-1)) )THEN
              index = index + Ls(i)
              IF(index-1==N)THEN
                flag = .true.
                EXIT outer
              END IF
              CYCLE outer
            END IF
          END IF
        END DO inner
        flag = .false.
        EXIT outer
        
      END DO outer
      
      IF(flag)THEN
        print'(A)','YES'
      ELSE
        print'(A)','NO'
      END IF
      
      
      END PROGRAM
      