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")

def solve():

    S = eval(input())

    # print(S, len(S))



    S = S[::-1]

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



    i = 0

    while True:

        can = False

        for word in words:

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

                i += len(word)

                can = True



        if i == len(S):

            return True



        if can is False:

            return False





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")

def solve():
    S = eval(input())
    # print(S, len(S))
    S = S[::-1]
    words = ("dream"[::-1], "dreamer"[::-1], "erase"[::-1], "eraser"[::-1])
    i = 0
    while True:
        can = False
        for word in words:
            if S[i : i + len(word)] == word:
                i += len(word)
                can = True
        if i == len(S):
            return True
        if can is False:
            return False


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

-import sys - -sys.setrecursionlimit(10**6) - - - -    def recur(i): -        if i >= len(S): -            return True +    i = 0 +    while True: +        can = False -                if recur(i + len(word)): -                    return True -        return False - -    ans = recur(0) -    return ans +                i += len(word) +                can = True +        if i == len(S): +            return True +        if can is False: +            return False