S = eval(input())

S = S[::-1]



last = ['maerd', 'remaerd', 'esare', 'resare']

length = [5, 7, 5, 6]



index = 0

while index < len(S):

    for i, tail in enumerate(last) :

        sub = S[index:index + length[i]]

        if sub == tail :

            index += length[i]

            break

    else :

        print('NO')

        break

else :

    print('YES')
S = input()[::-1]

W = [s[::-1] for s in ('dream', 'dreamer', 'erase', 'eraser')]



def isOk():

    now = 0

    while now < len(S):

        for w in W:

            if S[now: now + len(w)] == w:

                now += len(w)

                break

        else:

            return False

    return True



print(('YES' if isOk() else 'NO'))

S = eval(input())
S = S[::-1]
last = ["maerd", "remaerd", "esare", "resare"]
length = [5, 7, 5, 6]
index = 0
while index < len(S):
    for i, tail in enumerate(last):
        sub = S[index : index + length[i]]
        if sub == tail:
            index += length[i]
            break
    else:
        print("NO")
        break
else:
    print("YES")

S = input()[::-1]
W = [s[::-1] for s in ("dream", "dreamer", "erase", "eraser")]


def isOk():
    now = 0
    while now < len(S):
        for w in W:
            if S[now : now + len(w)] == w:
                now += len(w)
                break
        else:
            return False
    return True


print(("YES" if isOk() else "NO"))

-S = eval(input()) -S = S[::-1] -last = ["maerd", "remaerd", "esare", "resare"] -length = [5, 7, 5, 6] -index = 0 -while index < len(S): -    for i, tail in enumerate(last): -        sub = S[index : index + length[i]] -        if sub == tail: -            index += length[i] -            break -    else: -        print("NO") -        break -else: -    print("YES") +S = input()[::-1] +W = [s[::-1] for s in ("dream", "dreamer", "erase", "eraser")] + + +def isOk(): +    now = 0 +    while now < len(S): +        for w in W: +            if S[now : now + len(w)] == w: +                now += len(w) +                break +        else: +            return False +    return True + + +print(("YES" if isOk() else "NO"))