def main():

    S = eval(input())



    while len(S) >= 5:

        if len(S) >= 7 and S[-7:] == "dreamer":

            S = S[:-7]

            continue



        if len(S) >= 6 and S[-6:] == "eraser":

            S = S[:-6]

            continue



        if S[-5:] == "dream" or S[-5:] == "erase":

            S = S[:-5]

            continue



        break



    if len(S) == 0:

        print("YES")

    else:

        print("NO")



main()
import re

s = eval(input())

expression = ")eraser|dreamer|erase|dream("[::-1]

pattern = re.compile(expression)

ans = re.sub(pattern,"", s[::-1])

if ans == "":

	print("YES")

else:

    print("NO")
def main():
    S = eval(input())
    while len(S) >= 5:
        if len(S) >= 7 and S[-7:] == "dreamer":
            S = S[:-7]
            continue
        if len(S) >= 6 and S[-6:] == "eraser":
            S = S[:-6]
            continue
        if S[-5:] == "dream" or S[-5:] == "erase":
            S = S[:-5]
            continue
        break
    if len(S) == 0:
        print("YES")
    else:
        print("NO")


main()

import re

s = eval(input())
expression = ")eraser|dreamer|erase|dream("[::-1]
pattern = re.compile(expression)
ans = re.sub(pattern, "", s[::-1])
if ans == "":
    print("YES")
else:
    print("NO")

-def main(): -    S = eval(input()) -    while len(S) >= 5: -        if len(S) >= 7 and S[-7:] == "dreamer": -            S = S[:-7] -            continue -        if len(S) >= 6 and S[-6:] == "eraser": -            S = S[:-6] -            continue -        if S[-5:] == "dream" or S[-5:] == "erase": -            S = S[:-5] -            continue -        break -    if len(S) == 0: -        print("YES") -    else: -        print("NO") +import re - -main() +s = eval(input()) +expression = ")eraser|dreamer|erase|dream("[::-1] +pattern = re.compile(expression) +ans = re.sub(pattern, "", s[::-1]) +if ans == "": +    print("YES") +else: +    print("NO")