#049 C



S = eval(input())

A = 'dream'

B = 'dreamer'

C = 'erase'

D = 'eraser'



S=S[::-1]

A=A[::-1]

B=B[::-1]

C=C[::-1]

D=D[::-1]



tmp =""

for i in S:

    tmp +=i

    for j in [A,B,C,D]:

        if tmp == j:

            S=S.replace(tmp,"",1)

            tmp=""

if len(S)==0:

    print('YES')

else:

    print('NO')
# C - 白昼夢

S = eval(input())

S2 = S

W_L = ["dream","dreamer","erase","eraser"]

while True:

    cnt = 0

    for w in W_L:

        if S2.endswith(w):

            S2 = S2[:-(len(w))]

            cnt+=1

    if cnt ==0:

        print('NO')

        exit()

            

    if len(S2)<=7:

        break

    

if S2 ==''or S2 in W_L:

    print('YES')

else:

    print('NO')
# 049 C
S = eval(input())
A = "dream"
B = "dreamer"
C = "erase"
D = "eraser"
S = S[::-1]
A = A[::-1]
B = B[::-1]
C = C[::-1]
D = D[::-1]
tmp = ""
for i in S:
    tmp += i
    for j in [A, B, C, D]:
        if tmp == j:
            S = S.replace(tmp, "", 1)
            tmp = ""
if len(S) == 0:
    print("YES")
else:
    print("NO")

# C - 白昼夢
S = eval(input())
S2 = S
W_L = ["dream", "dreamer", "erase", "eraser"]
while True:
    cnt = 0
    for w in W_L:
        if S2.endswith(w):
            S2 = S2[: -(len(w))]
            cnt += 1
    if cnt == 0:
        print("NO")
        exit()
    if len(S2) <= 7:
        break
if S2 == "" or S2 in W_L:
    print("YES")
else:
    print("NO")

-# 049 C +# C - 白昼夢 -A = "dream" -B = "dreamer" -C = "erase" -D = "eraser" -S = S[::-1] -A = A[::-1] -B = B[::-1] -C = C[::-1] -D = D[::-1] -tmp = "" -for i in S: -    tmp += i -    for j in [A, B, C, D]: -        if tmp == j: -            S = S.replace(tmp, "", 1) -            tmp = "" -if len(S) == 0: +S2 = S +W_L = ["dream", "dreamer", "erase", "eraser"] +while True: +    cnt = 0 +    for w in W_L: +        if S2.endswith(w): +            S2 = S2[: -(len(w))] +            cnt += 1 +    if cnt == 0: +        print("NO") +        exit() +    if len(S2) <= 7: +        break +if S2 == "" or S2 in W_L: