S = eval(input())



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



damm = True



T = ''



while damm:

    damm = False

    for test in words:

        if S.endswith(test+T):

            T = test + T

            damm = True

            break

    if S == T:

        damm = True

        break



if damm:

    print('YES')

else:

    print('NO')

# import numpy as np

# import math

# import copy

# from collections import deque

import sys

input = sys.stdin.readline

# sys.setrecursionlimit(10000)





def main():

    S = input().rstrip()



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



    res = 'YES'



    pre = S

    now = S



    while True:

        for i in range(4):

            word = words[i]

            N = len(word)

            M = len(now)

            if N <= M:

                r = now[M-N:]

                if r == word:

                    now = now[:M-N]

        if now == '':

            break

        elif now == pre:

            res = 'NO'

            break

        else:

            pre = now



    print(res)







main()

S = eval(input())
words = ["dream", "dreamer", "erase", "eraser"]
damm = True
T = ""
while damm:
    damm = False
    for test in words:
        if S.endswith(test + T):
            T = test + T
            damm = True
            break
    if S == T:
        damm = True
        break
if damm:
    print("YES")
else:
    print("NO")

# import numpy as np
# import math
# import copy
# from collections import deque
import sys

input = sys.stdin.readline
# sys.setrecursionlimit(10000)
def main():
    S = input().rstrip()
    words = ["dream", "dreamer", "erase", "eraser"]
    res = "YES"
    pre = S
    now = S
    while True:
        for i in range(4):
            word = words[i]
            N = len(word)
            M = len(now)
            if N <= M:
                r = now[M - N :]
                if r == word:
                    now = now[: M - N]
        if now == "":
            break
        elif now == pre:
            res = "NO"
            break
        else:
            pre = now
    print(res)


main()

-S = eval(input()) -words = ["dream", "dreamer", "erase", "eraser"] -damm = True -T = "" -while damm: -    damm = False -    for test in words: -        if S.endswith(test + T): -            T = test + T -            damm = True +# import numpy as np +# import math +# import copy +# from collections import deque +import sys + +input = sys.stdin.readline +# sys.setrecursionlimit(10000) +def main(): +    S = input().rstrip() +    words = ["dream", "dreamer", "erase", "eraser"] +    res = "YES" +    pre = S +    now = S +    while True: +        for i in range(4): +            word = words[i] +            N = len(word) +            M = len(now) +            if N <= M: +                r = now[M - N :] +                if r == word: +                    now = now[: M - N] +        if now == "": -    if S == T: -        damm = True -        break -if damm: -    print("YES") -else: -    print("NO") +        elif now == pre: +            res = "NO" +            break +        else: +            pre = now +    print(res) + + +main()