S = input()[::-1]

T = ["dream"[::-1],"dreamer"[::-1],"erase"[::-1],"eraser"[::-1]]

Ans = "YES"

while len(S) > 0:

    if S[0:5] in T:

        S = S[5:]

        continue

    elif S[0:6] in T:

        S = S[6:]

        continue

    elif S[0:7] in T:

        S = S[7:]

        continue

    else:

        Ans = "NO"

        break

print(Ans)
import sys

S = eval(input())

S = S[::-1]



AR = []

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

for a in A:

    AR.append(a[::-1])



i = 0

while i < len(S):

    for ar in AR:

        l = len(ar)

        if ar == S[i:i+l]:

            i += l

            break

    else:

        print("NO")

        sys.exit()



print("YES")



S = input()[::-1]
T = ["dream"[::-1], "dreamer"[::-1], "erase"[::-1], "eraser"[::-1]]
Ans = "YES"
while len(S) > 0:
    if S[0:5] in T:
        S = S[5:]
        continue
    elif S[0:6] in T:
        S = S[6:]
        continue
    elif S[0:7] in T:
        S = S[7:]
        continue
    else:
        Ans = "NO"
        break
print(Ans)

import sys

S = eval(input())
S = S[::-1]
AR = []
A = ["dream", "dreamer", "erase", "eraser"]
for a in A:
    AR.append(a[::-1])
i = 0
while i < len(S):
    for ar in AR:
        l = len(ar)
        if ar == S[i : i + l]:
            i += l
            break
    else:
        print("NO")
        sys.exit()
print("YES")

-S = input()[::-1] -T = ["dream"[::-1], "dreamer"[::-1], "erase"[::-1], "eraser"[::-1]] -Ans = "YES" -while len(S) > 0: -    if S[0:5] in T: -        S = S[5:] -        continue -    elif S[0:6] in T: -        S = S[6:] -        continue -    elif S[0:7] in T: -        S = S[7:] -        continue +import sys + +S = eval(input()) +S = S[::-1] +AR = [] +A = ["dream", "dreamer", "erase", "eraser"] +for a in A: +    AR.append(a[::-1]) +i = 0 +while i < len(S): +    for ar in AR: +        l = len(ar) +        if ar == S[i : i + l]: +            i += l +            break -        Ans = "NO" -        break -print(Ans) +        print("NO") +        sys.exit() +print("YES")