S = str(eval(input()))

T = ''

cnt = 0

while True:

    if S[cnt:cnt+5] == 'dream':

        try:

            if S[cnt:cnt+7] == 'dreamer' and (S[cnt+7] != 'a'):

                cnt += 7

                T = T + 'dreamer'

            else:

                T = T + 'dream'

                cnt += 5

        except IndexError:

            cnt += 7

            T = T + 'dreamer'



    elif S[cnt:cnt+5] == 'erase':

        try:

            if S[cnt:cnt+6] == 'eraser' and S[cnt+6] != 'a':

                cnt += 6

                T = T + 'eraser'

            else:

                cnt += 5

                T = T + 'erase'

        except IndexError:

            cnt += 6

            T = T + 'eraser'

    else:

        break



    if len(S) <= cnt:

        break



if S == T:

    print('YES')

else:

    print('NO')
s = eval(input())

l = ['eraser', 'dreamer', 'erase', 'dream', 'ase']

for i in l:

    s = s.replace(i, '')

if len(s) == 0:

    print('YES')

else:

    print('NO')
S = str(eval(input()))
T = ""
cnt = 0
while True:
    if S[cnt : cnt + 5] == "dream":
        try:
            if S[cnt : cnt + 7] == "dreamer" and (S[cnt + 7] != "a"):
                cnt += 7
                T = T + "dreamer"
            else:
                T = T + "dream"
                cnt += 5
        except IndexError:
            cnt += 7
            T = T + "dreamer"
    elif S[cnt : cnt + 5] == "erase":
        try:
            if S[cnt : cnt + 6] == "eraser" and S[cnt + 6] != "a":
                cnt += 6
                T = T + "eraser"
            else:
                cnt += 5
                T = T + "erase"
        except IndexError:
            cnt += 6
            T = T + "eraser"
    else:
        break
    if len(S) <= cnt:
        break
if S == T:
    print("YES")
else:
    print("NO")

s = eval(input())
l = ["eraser", "dreamer", "erase", "dream", "ase"]
for i in l:
    s = s.replace(i, "")
if len(s) == 0:
    print("YES")
else:
    print("NO")

-S = str(eval(input())) -T = "" -cnt = 0 -while True: -    if S[cnt : cnt + 5] == "dream": -        try: -            if S[cnt : cnt + 7] == "dreamer" and (S[cnt + 7] != "a"): -                cnt += 7 -                T = T + "dreamer" -            else: -                T = T + "dream" -                cnt += 5 -        except IndexError: -            cnt += 7 -            T = T + "dreamer" -    elif S[cnt : cnt + 5] == "erase": -        try: -            if S[cnt : cnt + 6] == "eraser" and S[cnt + 6] != "a": -                cnt += 6 -                T = T + "eraser" -            else: -                cnt += 5 -                T = T + "erase" -        except IndexError: -            cnt += 6 -            T = T + "eraser" -    else: -        break -    if len(S) <= cnt: -        break -if S == T: +s = eval(input()) +l = ["eraser", "dreamer", "erase", "dream", "ase"] +for i in l: +    s = s.replace(i, "") +if len(s) == 0: