PROGRAM DAYDREAM
    IMPLICIT NONE
    CHARACTER(100000) S, SUBS
    INTEGER L
    READ(*, *) S
    L = LEN(TRIM(S))
    DO
        IF(L .EQ. 0) THEN
            WRITE(*, '(A)') 'YES'
            STOP
        ELSE IF(L .LT. 0) THEN
            WRITE(*, '(A)') 'NO'
            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
            WRITE(*, '(A)') 'NO'
            STOP
        ENDIF
    ENDDO
    STOP
END PROGRAM DAYDREAM
