S = eval(input())



start = 0



while start < len(S):



    if start == len(S)-8 or start > len(S)-5:

        print("NO")

        exit()

    elif start == len(S)-7 and S[start:start+7] == "dreamer":

        print("YES")

        exit()

    elif start == len(S)-6 and S[start:start+6] == "eraser":

        print("YES")

        exit()

    elif start == len(S)-5 and S[start:start+5] == "erase":

        print("YES")

        exit()

    elif start == len(S)-5 and S[start:start+5] == "dream":

        print("YES")

        exit()

    elif S[start:start+6] == "eraser":

        start +=6

    elif S[start:start+5] == "erase":

        start +=5

    elif S[start:start+8] == "dreamera":

        start +=5

    elif S[start:start+7] == "dreamer":

        start +=7

    elif S[start:start+5] == "dream":

        start +=5

    else:

        print("NO")

        exit()

print("YES")


S = eval(input())



start = len(S)



while 0<start:



    if start < 5:

        print("NO")

        exit()

    elif start == 7 and S[start-7:start] == "dreamer":

        print("YES")

        exit()

    elif start == 6 and S[start-6:start] == "eraser":

        print("YES")

        exit()

    elif start == 5 and S[start-5:start] == "erase":

        print("YES")

        exit()

    elif start == 5 and S[start-5:start] == "dream":

        print("YES")

        exit()

    elif S[start-6:start] == "eraser":

        start -=6

    elif S[start-5:start] == "erase":

        start -=5

    elif S[start-5:start] == "dream":

        start -=5

    elif S[start-7:start] == "dreamer":

        start -=7

    else:

        print("NO")

        exit()

print("YES")
S = eval(input())
start = 0
while start < len(S):
    if start == len(S) - 8 or start > len(S) - 5:
        print("NO")
        exit()
    elif start == len(S) - 7 and S[start : start + 7] == "dreamer":
        print("YES")
        exit()
    elif start == len(S) - 6 and S[start : start + 6] == "eraser":
        print("YES")
        exit()
    elif start == len(S) - 5 and S[start : start + 5] == "erase":
        print("YES")
        exit()
    elif start == len(S) - 5 and S[start : start + 5] == "dream":
        print("YES")
        exit()
    elif S[start : start + 6] == "eraser":
        start += 6
    elif S[start : start + 5] == "erase":
        start += 5
    elif S[start : start + 8] == "dreamera":
        start += 5
    elif S[start : start + 7] == "dreamer":
        start += 7
    elif S[start : start + 5] == "dream":
        start += 5
    else:
        print("NO")
        exit()
print("YES")

S = eval(input())
start = len(S)
while 0 < start:
    if start < 5:
        print("NO")
        exit()
    elif start == 7 and S[start - 7 : start] == "dreamer":
        print("YES")
        exit()
    elif start == 6 and S[start - 6 : start] == "eraser":
        print("YES")
        exit()
    elif start == 5 and S[start - 5 : start] == "erase":
        print("YES")
        exit()
    elif start == 5 and S[start - 5 : start] == "dream":
        print("YES")
        exit()
    elif S[start - 6 : start] == "eraser":
        start -= 6
    elif S[start - 5 : start] == "erase":
        start -= 5
    elif S[start - 5 : start] == "dream":
        start -= 5
    elif S[start - 7 : start] == "dreamer":
        start -= 7
    else:
        print("NO")
        exit()
print("YES")

-start = 0 -while start < len(S): -    if start == len(S) - 8 or start > len(S) - 5: +start = len(S) +while 0 < start: +    if start < 5: -    elif start == len(S) - 7 and S[start : start + 7] == "dreamer": +    elif start == 7 and S[start - 7 : start] == "dreamer": -    elif start == len(S) - 6 and S[start : start + 6] == "eraser": +    elif start == 6 and S[start - 6 : start] == "eraser": -    elif start == len(S) - 5 and S[start : start + 5] == "erase": +    elif start == 5 and S[start - 5 : start] == "erase": -    elif start == len(S) - 5 and S[start : start + 5] == "dream": +    elif start == 5 and S[start - 5 : start] == "dream": -    elif S[start : start + 6] == "eraser": -        start += 6 -    elif S[start : start + 5] == "erase": -        start += 5 -    elif S[start : start + 8] == "dreamera": -        start += 5 -    elif S[start : start + 7] == "dreamer": -        start += 7 -    elif S[start : start + 5] == "dream": -        start += 5 +    elif S[start - 6 : start] == "eraser": +        start -= 6 +    elif S[start - 5 : start] == "erase": +        start -= 5 +    elif S[start - 5 : start] == "dream": +        start -= 5 +    elif S[start - 7 : start] == "dreamer": +        start -= 7