import sys

sys.setrecursionlimit(10 ** 6)





def solve():

    S = eval(input())

    # print(S, len(S))



    words = {0: "dream", 1: "dreamer", 2: "erase", 3: "eraser"}



    TABLE = [[-1 for x in range(len(S) + 1)] for y in range(len(words) + 1)]



    def recur(i, w):

        if not TABLE[w][i] == -1:

            return TABLE[w][i]



        if i >= len(S):

            # print("jey", log)

            return True



        r1, r2, r3, r4 = False, False, False, False

        if S[i:i + 5] == words[0]:

            r1 = recur(i + 5, 0)

        if S[i:i + 7] == words[1]:

            r2 = recur(i + 7, 1)

        if S[i:i + 5] == words[2]:

            r3 = recur(i + 5, 2)

        if S[i:i + 6] == words[3]:

            r4 = recur(i + 6, 3)



        TABLE[w][i] = r1 or r2 or r3 or r4 or False



        return TABLE[w][i]



    ans = recur(0, 0)



    return ans





if __name__ == '__main__':

    res = solve()

    if res:

        print("YES")

    else:

        print("NO")

import sys

sys.setrecursionlimit(10 ** 6)



def solve():

    S = eval(input())

    # print(S, len(S))



    S = S[::-1]

    words = ("dream"[::-1], "dreamer"[::-1], "erase"[::-1], "eraser"[::-1])



    def recur(i):

        if i >= len(S):

            return True



        for word in words:

            if S[i:i + len(word)] == word:

                if recur(i + len(word)):

                    return True

        return False



    ans = recur(0)



    return ans





if __name__ == '__main__':

    res = solve()

    if res:

        print("YES")

    else:

        print("NO")

import sys

sys.setrecursionlimit(10**6)


def solve():
    S = eval(input())
    # print(S, len(S))
    words = {0: "dream", 1: "dreamer", 2: "erase", 3: "eraser"}
    TABLE = [[-1 for x in range(len(S) + 1)] for y in range(len(words) + 1)]

    def recur(i, w):
        if not TABLE[w][i] == -1:
            return TABLE[w][i]
        if i >= len(S):
            # print("jey", log)
            return True
        r1, r2, r3, r4 = False, False, False, False
        if S[i : i + 5] == words[0]:
            r1 = recur(i + 5, 0)
        if S[i : i + 7] == words[1]:
            r2 = recur(i + 7, 1)
        if S[i : i + 5] == words[2]:
            r3 = recur(i + 5, 2)
        if S[i : i + 6] == words[3]:
            r4 = recur(i + 6, 3)
        TABLE[w][i] = r1 or r2 or r3 or r4 or False
        return TABLE[w][i]

    ans = recur(0, 0)
    return ans


if __name__ == "__main__":
    res = solve()
    if res:
        print("YES")
    else:
        print("NO")

import sys

sys.setrecursionlimit(10**6)


def solve():
    S = eval(input())
    # print(S, len(S))
    S = S[::-1]
    words = ("dream"[::-1], "dreamer"[::-1], "erase"[::-1], "eraser"[::-1])

    def recur(i):
        if i >= len(S):
            return True
        for word in words:
            if S[i : i + len(word)] == word:
                if recur(i + len(word)):
                    return True
        return False

    ans = recur(0)
    return ans


if __name__ == "__main__":
    res = solve()
    if res:
        print("YES")
    else:
        print("NO")

-    words = {0: "dream", 1: "dreamer", 2: "erase", 3: "eraser"} -    TABLE = [[-1 for x in range(len(S) + 1)] for y in range(len(words) + 1)] +    S = S[::-1] +    words = ("dream"[::-1], "dreamer"[::-1], "erase"[::-1], "eraser"[::-1]) -    def recur(i, w): -        if not TABLE[w][i] == -1: -            return TABLE[w][i] +    def recur(i): -            # print("jey", log) -        r1, r2, r3, r4 = False, False, False, False -        if S[i : i + 5] == words[0]: -            r1 = recur(i + 5, 0) -        if S[i : i + 7] == words[1]: -            r2 = recur(i + 7, 1) -        if S[i : i + 5] == words[2]: -            r3 = recur(i + 5, 2) -        if S[i : i + 6] == words[3]: -            r4 = recur(i + 6, 3) -        TABLE[w][i] = r1 or r2 or r3 or r4 or False -        return TABLE[w][i] +        for word in words: +            if S[i : i + len(word)] == word: +                if recur(i + len(word)): +                    return True +        return False -    ans = recur(0, 0) +    ans = recur(0)