s = eval(input())



t = s.replace("dreameraser","1")

t = t.replace("dreamerase","2")

t = t.replace("dreamer","3")

t = t.replace("eraser","4")

t = t.replace("dream","5")

t = t.replace("erase","6")



try:

    int(t)

    print("YES")

except :

    print("NO")
s = eval(input())



t = s.replace("eraser","")

t = t.replace("erase","")

t = t.replace("dreamer","")

t = t.replace("dream","")



if len(t)==0:

    print("YES")

else :

    print("NO")
s = eval(input())
t = s.replace("dreameraser", "1")
t = t.replace("dreamerase", "2")
t = t.replace("dreamer", "3")
t = t.replace("eraser", "4")
t = t.replace("dream", "5")
t = t.replace("erase", "6")
try:
    int(t)
    print("YES")
except:
    print("NO")

s = eval(input())
t = s.replace("eraser", "")
t = t.replace("erase", "")
t = t.replace("dreamer", "")
t = t.replace("dream", "")
if len(t) == 0:
    print("YES")
else:
    print("NO")

-t = s.replace("dreameraser", "1") -t = t.replace("dreamerase", "2") -t = t.replace("dreamer", "3") -t = t.replace("eraser", "4") -t = t.replace("dream", "5") -t = t.replace("erase", "6") -try: -    int(t) +t = s.replace("eraser", "") +t = t.replace("erase", "") +t = t.replace("dreamer", "") +t = t.replace("dream", "") +if len(t) == 0: -except: +else: