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')
S = eval(input())

Srev = S[::-1]

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



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

Trev = [t[::-1] for t in T]



i = 0

while i < len(S):

    for j, t in enumerate(Trev):

        if Srev[i:i+lenT[j]] == t:

            i += lenT[j]     #; print(i, j, t) 

            break

    else:

        print('NO')

        break

else:

    print('YES')

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")

S = eval(input())
Srev = S[::-1]
T = ["dream", "dreamer", "erase", "eraser"]
lenT = [len(i) for i in T]
Trev = [t[::-1] for t in T]
i = 0
while i < len(S):
    for j, t in enumerate(Trev):
        if Srev[i : i + lenT[j]] == t:
            i += lenT[j]  # ; print(i, j, t)
            break
    else:
        print("NO")
        break
else:
    print("YES")

-import sys - -sys.setrecursionlimit(1000000) +Srev = S[::-1] - - -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: +Trev = [t[::-1] for t in T] +i = 0 +while i < len(S): +    for j, t in enumerate(Trev): +        if Srev[i : i + lenT[j]] == t: +            i += lenT[j]  # ; print(i, j, t) +            break +    else: +        print("NO") +        break +else: -else: -    print("NO")