def main():

    S = input()

    S = S[::-1]

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

    while S:

        for a in ans:

            if S[:5] in ans:

                S = S.replace(S[:5], "", 1)

                break

            elif S[:6] in ans:

                S = S.replace(S[:6], "", 1)

                break

            elif S[:7] in ans:

                S = S.replace(S[:7], "", 1)

                break

        else:

            return print("NO")

    else:

        return print("YES")





if __name__ == '__main__':

    main()

def main():

    S = input()

    if S.replace("eraser", "").replace("erase", "").replace("dreamer", "").\

            replace("dream", ""):

        return print("NO")

    else:

        return print("YES")





if __name__ == '__main__':

    main()

def main():
    S = input()
    S = S[::-1]
    ans = ["maerd", "remaerd", "esare", "resare"]
    while S:
        for a in ans:
            if S[:5] in ans:
                S = S.replace(S[:5], "", 1)
                break
            elif S[:6] in ans:
                S = S.replace(S[:6], "", 1)
                break
            elif S[:7] in ans:
                S = S.replace(S[:7], "", 1)
                break
        else:
            return print("NO")
    else:
        return print("YES")


if __name__ == "__main__":
    main()

def main():
    S = input()
    if (
        S.replace("eraser", "")
        .replace("erase", "")
        .replace("dreamer", "")
        .replace("dream", "")
    ):
        return print("NO")
    else:
        return print("YES")


if __name__ == "__main__":
    main()

-    S = S[::-1] -    ans = ["maerd", "remaerd", "esare", "resare"] -    while S: -        for a in ans: -            if S[:5] in ans: -                S = S.replace(S[:5], "", 1) -                break -            elif S[:6] in ans: -                S = S.replace(S[:6], "", 1) -                break -            elif S[:7] in ans: -                S = S.replace(S[:7], "", 1) -                break -        else: -            return print("NO") +    if ( +        S.replace("eraser", "") +        .replace("erase", "") +        .replace("dreamer", "") +        .replace("dream", "") +    ): +        return print("NO")