#C問題

S=str(eval(input()))

Slist=list(S)

Slen=len(Slist)

Srev=Slist[::-1]

kari=""

for i in range(Slen):

    if len(kari) == 5:

        if kari == "maerd":

            kari=Srev[i]

        elif kari == "esare":

            kari=Srev[i]

        else:

            kari+=Srev[i]

    elif len(kari) == 6:

        if kari == "resare":

            kari=Srev[i]

        else:

            kari+=Srev[i]

    elif len(kari) == 7:

        if kari == "remaerd":

            kari=Srev[i]

        else:

            break

    else:

        kari+=Srev[i]

if kari == "esare" or kari == "maerd" or kari == "resare" or kari == "remaerd":

    print("YES")

else:

    print("NO")
#C問題

import re

S = str(eval(input()))

p = re.match('(dream|dreamer|erase|eraser)+$',S)

if p:

    print("YES")

else:

    print("NO")
# C問題
S = str(eval(input()))
Slist = list(S)
Slen = len(Slist)
Srev = Slist[::-1]
kari = ""
for i in range(Slen):
    if len(kari) == 5:
        if kari == "maerd":
            kari = Srev[i]
        elif kari == "esare":
            kari = Srev[i]
        else:
            kari += Srev[i]
    elif len(kari) == 6:
        if kari == "resare":
            kari = Srev[i]
        else:
            kari += Srev[i]
    elif len(kari) == 7:
        if kari == "remaerd":
            kari = Srev[i]
        else:
            break
    else:
        kari += Srev[i]
if kari == "esare" or kari == "maerd" or kari == "resare" or kari == "remaerd":
    print("YES")
else:
    print("NO")

# C問題
import re

S = str(eval(input()))
p = re.match("(dream|dreamer|erase|eraser)+$", S)
if p:
    print("YES")
else:
    print("NO")

+import re + -Slist = list(S) -Slen = len(Slist) -Srev = Slist[::-1] -kari = "" -for i in range(Slen): -    if len(kari) == 5: -        if kari == "maerd": -            kari = Srev[i] -        elif kari == "esare": -            kari = Srev[i] -        else: -            kari += Srev[i] -    elif len(kari) == 6: -        if kari == "resare": -            kari = Srev[i] -        else: -            kari += Srev[i] -    elif len(kari) == 7: -        if kari == "remaerd": -            kari = Srev[i] -        else: -            break -    else: -        kari += Srev[i] -if kari == "esare" or kari == "maerd" or kari == "resare" or kari == "remaerd": +p = re.match("(dream|dreamer|erase|eraser)+$", S) +if p: