def solve(s, ws):

    while True:

        find_w = False

        for w in ws:

            if s.startswith(w):

                s = s[len(w):]

                find_w = True

                break

        if not s:

            return "YES"

        elif not find_w:

            return "NO"

    return None





S = input()[::-1]

WS = [w[::-1] for w in['dream', 'dreamer', 'erase', 'eraser']]

print((solve(S, WS)))
import re



S = eval(input())

result = re.match(r'\A(dream(er)?|erase(r)?)+\Z', S)

if result:

    print('YES')

else:

    print('NO')
def solve(s, ws):
    while True:
        find_w = False
        for w in ws:
            if s.startswith(w):
                s = s[len(w) :]
                find_w = True
                break
        if not s:
            return "YES"
        elif not find_w:
            return "NO"
    return None


S = input()[::-1]
WS = [w[::-1] for w in ["dream", "dreamer", "erase", "eraser"]]
print((solve(S, WS)))

import re

S = eval(input())
result = re.match(r"\A(dream(er)?|erase(r)?)+\Z", S)
if result:
    print("YES")
else:
    print("NO")

-def solve(s, ws): -    while True: -        find_w = False -        for w in ws: -            if s.startswith(w): -                s = s[len(w) :] -                find_w = True -                break -        if not s: -            return "YES" -        elif not find_w: -            return "NO" -    return None +import re - -S = input()[::-1] -WS = [w[::-1] for w in ["dream", "dreamer", "erase", "eraser"]] -print((solve(S, WS))) +S = eval(input()) +result = re.match(r"\A(dream(er)?|erase(r)?)+\Z", S) +if result: +    print("YES") +else: +    print("NO")