def resolve():

	s = eval(input())

	w = ['dream', 'dreamer', 'erase', 'eraser']

	h = dict()

	for i in range(len(w)):

		h[w[i][::-1]] = True

	s = s[::-1]

	c = ''

	for i in s:

		c += i

		if h.get(c):

			c = ''

	if not len(c):

		print('YES')

	else:

		print('NO')

resolve()
import re

def resolve():

	s = eval(input())

	if re.search("^(dream|dreamer|erase|eraser)+$", s):

		print("YES")

	else:

		print("NO")

resolve()

def resolve():
    s = eval(input())
    w = ["dream", "dreamer", "erase", "eraser"]
    h = dict()
    for i in range(len(w)):
        h[w[i][::-1]] = True
    s = s[::-1]
    c = ""
    for i in s:
        c += i
        if h.get(c):
            c = ""
    if not len(c):
        print("YES")
    else:
        print("NO")


resolve()

import re


def resolve():
    s = eval(input())
    if re.search("^(dream|dreamer|erase|eraser)+$", s):
        print("YES")
    else:
        print("NO")


resolve()

+import re + + -    w = ["dream", "dreamer", "erase", "eraser"] -    h = dict() -    for i in range(len(w)): -        h[w[i][::-1]] = True -    s = s[::-1] -    c = "" -    for i in s: -        c += i -        if h.get(c): -            c = "" -    if not len(c): +    if re.search("^(dream|dreamer|erase|eraser)+$", s):