S = eval(input())

Sb = S[::-1]

daydreamers = ["maerd", "remaerd", "esare", "resare"]

judge = True



i = 0

while i < len(S) and judge:

    temp = ""

    isThere = False

    for j in range(7):

        temp += Sb[i+j]

        if temp in daydreamers:

            isThere = True

            i = i+j+1

            break

    if not isThere:

        judge = False



print(("YES" if judge else "NO"))
def solve():

    S = eval(input())

    N = len(S)

    Srev = []

    for i in reversed(list(range(N))): Srev.append(S[i])

    Srev = "".join(Srev)

    ti = 0

    while ti < N:

        if Srev[ti] == "m":

            if Srev[ti:min(N, ti + 5)] == "maerd": ti += 5

            else:

                print("NO")

                break

        elif Srev[ti] == "e":

            if Srev[ti:min(N, ti + 5)] == "esare": ti += 5

            else:

                print("NO")

                break

        elif Srev[ti] == "r":

            if Srev[ti:min(N, ti + 6)] == "resare": ti += 6

            elif Srev[ti:min(N, ti + 7)] == "remaerd": ti += 7

            else:

                print("NO")

                break

        else:

            print("NO")

            break

    else: print("YES")





    return 0



if __name__ == "__main__":

    solve()
S = eval(input())
Sb = S[::-1]
daydreamers = ["maerd", "remaerd", "esare", "resare"]
judge = True
i = 0
while i < len(S) and judge:
    temp = ""
    isThere = False
    for j in range(7):
        temp += Sb[i + j]
        if temp in daydreamers:
            isThere = True
            i = i + j + 1
            break
    if not isThere:
        judge = False
print(("YES" if judge else "NO"))

def solve():
    S = eval(input())
    N = len(S)
    Srev = []
    for i in reversed(list(range(N))):
        Srev.append(S[i])
    Srev = "".join(Srev)
    ti = 0
    while ti < N:
        if Srev[ti] == "m":
            if Srev[ti : min(N, ti + 5)] == "maerd":
                ti += 5
            else:
                print("NO")
                break
        elif Srev[ti] == "e":
            if Srev[ti : min(N, ti + 5)] == "esare":
                ti += 5
            else:
                print("NO")
                break
        elif Srev[ti] == "r":
            if Srev[ti : min(N, ti + 6)] == "resare":
                ti += 6
            elif Srev[ti : min(N, ti + 7)] == "remaerd":
                ti += 7
            else:
                print("NO")
                break
        else:
            print("NO")
            break
    else:
        print("YES")
    return 0


if __name__ == "__main__":
    solve()

-S = eval(input()) -Sb = S[::-1] -daydreamers = ["maerd", "remaerd", "esare", "resare"] -judge = True -i = 0 -while i < len(S) and judge: -    temp = "" -    isThere = False -    for j in range(7): -        temp += Sb[i + j] -        if temp in daydreamers: -            isThere = True -            i = i + j + 1 +def solve(): +    S = eval(input()) +    N = len(S) +    Srev = [] +    for i in reversed(list(range(N))): +        Srev.append(S[i]) +    Srev = "".join(Srev) +    ti = 0 +    while ti < N: +        if Srev[ti] == "m": +            if Srev[ti : min(N, ti + 5)] == "maerd": +                ti += 5 +            else: +                print("NO") +                break +        elif Srev[ti] == "e": +            if Srev[ti : min(N, ti + 5)] == "esare": +                ti += 5 +            else: +                print("NO") +                break +        elif Srev[ti] == "r": +            if Srev[ti : min(N, ti + 6)] == "resare": +                ti += 6 +            elif Srev[ti : min(N, ti + 7)] == "remaerd": +                ti += 7 +            else: +                print("NO") +                break +        else: +            print("NO") -    if not isThere: -        judge = False -print(("YES" if judge else "NO")) +    else: +        print("YES") +    return 0 + + +if __name__ == "__main__": +    solve()