s=input()[::-1]

ans='YES'

while len(s)>0:

    if s[:5] in ['dream'[::-1],'erase'[::-1]]:

        s=s[5:]

    elif s[:6] in ['eraser'[::-1]]:

        s=s[6:]

    elif s[:7] in ['dreamer'[::-1]]:

        s=s[7:]

    else:

        ans='NO'

        break

print(ans)
import re

s=eval(input())

pat=r'^(dream(er)?|erase(r)?)*$'

a=re.match(pat,s)

print(('YES' if a else 'NO'))
s = input()[::-1]
ans = "YES"
while len(s) > 0:
    if s[:5] in ["dream"[::-1], "erase"[::-1]]:
        s = s[5:]
    elif s[:6] in ["eraser"[::-1]]:
        s = s[6:]
    elif s[:7] in ["dreamer"[::-1]]:
        s = s[7:]
    else:
        ans = "NO"
        break
print(ans)

import re

s = eval(input())
pat = r"^(dream(er)?|erase(r)?)*$"
a = re.match(pat, s)
print(("YES" if a else "NO"))

-s = input()[::-1] -ans = "YES" -while len(s) > 0: -    if s[:5] in ["dream"[::-1], "erase"[::-1]]: -        s = s[5:] -    elif s[:6] in ["eraser"[::-1]]: -        s = s[6:] -    elif s[:7] in ["dreamer"[::-1]]: -        s = s[7:] -    else: -        ans = "NO" -        break -print(ans) +import re + +s = eval(input()) +pat = r"^(dream(er)?|erase(r)?)*$" +a = re.match(pat, s) +print(("YES" if a else "NO"))