import sys

S = input()[::-1]

t = ['dream'[::-1], 'dreamer'[::-1], 'erase'[::-1], 'eraser'[::-1]]

while len(S) > 0:

    if S[:5] == t[0]:

        S = S[5:]

    elif S[:7] == t[1]:

        S = S[7:]

    elif S[:5] == t[2]:

        S = S[5:]

    elif S[:6] == t[3]:

        S = S[6:]

    else:

        print('NO')

        sys.exit()

print('YES')
import sys

S = eval(input())

S = S[::-1]

while S != '':

    if S[:5] == 'maerd':

        S = S[5:]

    elif S[:5] == 'esare':

        S = S[5:]

    elif S[:6] == 'resare':

        S = S[6:]

    elif S[:7] == 'remaerd':

        S = S[7:]

    else:

        print('NO')

        exit()

print('YES')
import sys

S = input()[::-1]
t = ["dream"[::-1], "dreamer"[::-1], "erase"[::-1], "eraser"[::-1]]
while len(S) > 0:
    if S[:5] == t[0]:
        S = S[5:]
    elif S[:7] == t[1]:
        S = S[7:]
    elif S[:5] == t[2]:
        S = S[5:]
    elif S[:6] == t[3]:
        S = S[6:]
    else:
        print("NO")
        sys.exit()
print("YES")

import sys

S = eval(input())
S = S[::-1]
while S != "":
    if S[:5] == "maerd":
        S = S[5:]
    elif S[:5] == "esare":
        S = S[5:]
    elif S[:6] == "resare":
        S = S[6:]
    elif S[:7] == "remaerd":
        S = S[7:]
    else:
        print("NO")
        exit()
print("YES")

-S = input()[::-1] -t = ["dream"[::-1], "dreamer"[::-1], "erase"[::-1], "eraser"[::-1]] -while len(S) > 0: -    if S[:5] == t[0]: +S = eval(input()) +S = S[::-1] +while S != "": +    if S[:5] == "maerd": -    elif S[:7] == t[1]: +    elif S[:5] == "esare": +        S = S[5:] +    elif S[:6] == "resare": +        S = S[6:] +    elif S[:7] == "remaerd": -    elif S[:5] == t[2]: -        S = S[5:] -    elif S[:6] == t[3]: -        S = S[6:] -        sys.exit() +        exit()