import sys

sys.setrecursionlimit(1000000)



S = eval(input())



T = ['dream', 'dreamer', 'erase', 'eraser']

lenT = [len(i) for i in T]



def dayDream(pin):

    global isDream               #;print('dayDream: ', pin, S[pin:])

    for i, d in enumerate(T):

        #print('d:', d)

        if S[pin:pin+lenT[i]] == d:            

            pout = pin + lenT[i] #; print(d, pout)

            if pout == len(S):                

                isDream = True   #; print('YES')

                return 

            else:

                dayDream(pout)

    #print('dayDream return', pin)

    return

    

isDream = False

dayDream(0)

if isDream:

    print('YES')

else:

    print('NO')
import sys

sys.setrecursionlimit(1000000)



S = eval(input())



T = ['dream', 'dreamer', 'erase', 'eraser']

lenT = [len(i) for i in T]



def dayDream(pin):

    global isGoal               #;print('dayDream: ', pin, S[pin:])

    for i, d in enumerate(T):

        if isGoal:

            return

        #print('i, d:', i, d)

        if S[pin:pin+lenT[i]] == d:            

            pout = pin + lenT[i] #;print(d, pout)

            if pout == len(S):                

                isGoal = True    #;print('YES')

                return 

            else:

                dayDream(pout)

    #print('dayDream return', pin)

    return

    

isGoal = False

dayDream(0)

if isGoal:

    print('YES')

else:

    print('NO')
import sys

sys.setrecursionlimit(1000000)
S = eval(input())
T = ["dream", "dreamer", "erase", "eraser"]
lenT = [len(i) for i in T]


def dayDream(pin):
    global isDream  # ;print('dayDream: ', pin, S[pin:])
    for i, d in enumerate(T):
        # print('d:', d)
        if S[pin : pin + lenT[i]] == d:
            pout = pin + lenT[i]  # ; print(d, pout)
            if pout == len(S):
                isDream = True  # ; print('YES')
                return
            else:
                dayDream(pout)
    # print('dayDream return', pin)
    return


isDream = False
dayDream(0)
if isDream:
    print("YES")
else:
    print("NO")

import sys

sys.setrecursionlimit(1000000)
S = eval(input())
T = ["dream", "dreamer", "erase", "eraser"]
lenT = [len(i) for i in T]


def dayDream(pin):
    global isGoal  # ;print('dayDream: ', pin, S[pin:])
    for i, d in enumerate(T):
        if isGoal:
            return
        # print('i, d:', i, d)
        if S[pin : pin + lenT[i]] == d:
            pout = pin + lenT[i]  # ;print(d, pout)
            if pout == len(S):
                isGoal = True  # ;print('YES')
                return
            else:
                dayDream(pout)
    # print('dayDream return', pin)
    return


isGoal = False
dayDream(0)
if isGoal:
    print("YES")
else:
    print("NO")

-    global isDream  # ;print('dayDream: ', pin, S[pin:]) +    global isGoal  # ;print('dayDream: ', pin, S[pin:]) -        # print('d:', d) +        if isGoal: +            return +        # print('i, d:', i, d) -            pout = pin + lenT[i]  # ; print(d, pout) +            pout = pin + lenT[i]  # ;print(d, pout) -                isDream = True  # ; print('YES') +                isGoal = True  # ;print('YES') -isDream = False +isGoal = False -if isDream: +if isGoal: