S = input()[::-1]



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



for i in m:

    S = S.replace(i[::-1],"")





print(("YES" if S == "" else "NO"))
S = eval(input())



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



for i in m:

    S = S.replace(i,"")





print(("YES" if S == "" else "NO"))
S = input()[::-1]
m = ["eraser", "erase", "dreamer", "dream"]
for i in m:
    S = S.replace(i[::-1], "")
print(("YES" if S == "" else "NO"))

S = eval(input())
m = ["eraser", "erase", "dreamer", "dream"]
for i in m:
    S = S.replace(i, "")
print(("YES" if S == "" else "NO"))

-S = input()[::-1] +S = eval(input()) -    S = S.replace(i[::-1], "") +    S = S.replace(i, "")