s = input()[::-1]

ans = 'YES'

while s:

    if s[:5] == 'maerd' or s[0:5] == 'esare':

        s = s[5:]

    elif s[:6] == 'resare':

        s = s[6:]

    elif s[:7] == 'remaerd':

        s = s[7:]

    else:

        ans = 'NO'

        break

print(ans)
s = eval(input())



s = s.replace('eraser', '')

s = s.replace('erase', '')

s = s.replace('dreamer', '')

s = s.replace('dream', '')



print(('NO' if s else 'YES'))
s = input()[::-1]
ans = "YES"
while s:
    if s[:5] == "maerd" or s[0:5] == "esare":
        s = s[5:]
    elif s[:6] == "resare":
        s = s[6:]
    elif s[:7] == "remaerd":
        s = s[7:]
    else:
        ans = "NO"
        break
print(ans)

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

-s = input()[::-1] -ans = "YES" -while s: -    if s[:5] == "maerd" or s[0:5] == "esare": -        s = s[5:] -    elif s[:6] == "resare": -        s = s[6:] -    elif s[:7] == "remaerd": -        s = s[7:] -    else: -        ans = "NO" -        break -print(ans) +s = eval(input()) +s = s.replace("eraser", "") +s = s.replace("erase", "") +s = s.replace("dreamer", "") +s = s.replace("dream", "") +print(("NO" if s else "YES"))