from collections import Counter,defaultdict,deque

import sys,heapq,bisect,math,itertools,string,queue

sys.setrecursionlimit(10**8)

mod = 10**9+7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))



s = eval(input())

n = len(s)

i = n

while i > 0:

    if s[i-7:i] == 'dreamer' and i-7 >= 0:

        i -= 7

    elif s[i-6:i] == 'eraser' and i-6 >= 0:

        i -= 6

    elif s[i-5:i] == 'dream' and i-5 >= 0:

        i -= 5

    elif s[i-5:i] == 'erase' and i-5 >= 0:

        i -= 5

    else:

        print('NO')

        break

else:

    print('YES')
from collections import Counter,defaultdict,deque

from heapq import heappop,heappush,heapify

from bisect import bisect_left,bisect_right 

import sys,math,itertools,fractions,pprint

sys.setrecursionlimit(10**8)

mod = 10**9+7

INF = float('inf')

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))



s = input()[::-1]

n = len(s)

d = [['maerd',5],['remaerd',7],['esare',5],['resare',6]]

ind = 0

while True:

    if ind == n:

        print('YES')

        break

    ok = False

    for t,a in d:

        if ind + a <= n and s[ind:ind+a] == t:

            # print(s[ind:ind+a],t)

            ind += a

            ok = True

            break

    if not ok:

        print('NO')

        break



from collections import Counter, defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue

sys.setrecursionlimit(10**8)
mod = 10**9 + 7


def inp():
    return int(sys.stdin.readline())


def inpl():
    return list(map(int, sys.stdin.readline().split()))


def inpl_str():
    return list(sys.stdin.readline().split())


def inpln(n):
    return list(int(sys.stdin.readline()) for i in range(n))


s = eval(input())
n = len(s)
i = n
while i > 0:
    if s[i - 7 : i] == "dreamer" and i - 7 >= 0:
        i -= 7
    elif s[i - 6 : i] == "eraser" and i - 6 >= 0:
        i -= 6
    elif s[i - 5 : i] == "dream" and i - 5 >= 0:
        i -= 5
    elif s[i - 5 : i] == "erase" and i - 5 >= 0:
        i -= 5
    else:
        print("NO")
        break
else:
    print("YES")

from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint

sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")


def inp():
    return int(sys.stdin.readline())


def inpl():
    return list(map(int, sys.stdin.readline().split()))


s = input()[::-1]
n = len(s)
d = [["maerd", 5], ["remaerd", 7], ["esare", 5], ["resare", 6]]
ind = 0
while True:
    if ind == n:
        print("YES")
        break
    ok = False
    for t, a in d:
        if ind + a <= n and s[ind : ind + a] == t:
            # print(s[ind:ind+a],t)
            ind += a
            ok = True
            break
    if not ok:
        print("NO")
        break

-import sys, heapq, bisect, math, itertools, string, queue +from heapq import heappop, heappush, heapify +from bisect import bisect_left, bisect_right +import sys, math, itertools, fractions, pprint +INF = float("inf") -def inpl_str(): -    return list(sys.stdin.readline().split()) - - -def inpln(n): -    return list(int(sys.stdin.readline()) for i in range(n)) - - -s = eval(input()) +s = input()[::-1] -i = n -while i > 0: -    if s[i - 7 : i] == "dreamer" and i - 7 >= 0: -        i -= 7 -    elif s[i - 6 : i] == "eraser" and i - 6 >= 0: -        i -= 6 -    elif s[i - 5 : i] == "dream" and i - 5 >= 0: -        i -= 5 -    elif s[i - 5 : i] == "erase" and i - 5 >= 0: -        i -= 5 -    else: +d = [["maerd", 5], ["remaerd", 7], ["esare", 5], ["resare", 6]] +ind = 0 +while True: +    if ind == n: +        print("YES") +        break +    ok = False +    for t, a in d: +        if ind + a <= n and s[ind : ind + a] == t: +            # print(s[ind:ind+a],t) +            ind += a +            ok = True +            break +    if not ok: -else: -    print("YES")