def main():

    S = eval(input())

    w1 = 'dream'[::-1]

    w2 = 'dreamer'[::-1]

    w3 = 'erase'[::-1]

    w4 = 'eraser'[::-1]

    # print(w1,w2,w3,w4)

    S = S[::-1]

    # print(S)



    # words = ['dream', 'dreamer', 'erase', 'eraser']

    words = [w1, w2, w3, w4]

    T = ''

    while S != T:

        cand = []

        for w in words:

            new_t = T + w

            cand.append(new_t) 

        # print('cand', cand)

        ans = False

        for c in cand:

            if c == S[:len(c)]:

                T = c

                ans = True



        if not ans:

            break



    if S == T:

        print('YES')

    else:

        print("NO")



if __name__ == "__main__":

    main()
def main():

    S = eval(input())

    w1 = 'dream'[::-1]

    w2 = 'dreamer'[::-1]

    w3 = 'erase'[::-1]

    w4 = 'eraser'[::-1]

    S = S[::-1]

    words = [w1, w2, w3, w4]



    flag = False

    i = 0

    while i < len(S):

        for w in words:

            if S[i:].startswith(w):

                i += len(w)

                flag = True

                break



        if not flag:

            print("NO")

            exit()

        flag = False



    print("YES")







if __name__ == "__main__":

    main()
def main():
    S = eval(input())
    w1 = "dream"[::-1]
    w2 = "dreamer"[::-1]
    w3 = "erase"[::-1]
    w4 = "eraser"[::-1]
    # print(w1,w2,w3,w4)
    S = S[::-1]
    # print(S)
    # words = ['dream', 'dreamer', 'erase', 'eraser']
    words = [w1, w2, w3, w4]
    T = ""
    while S != T:
        cand = []
        for w in words:
            new_t = T + w
            cand.append(new_t)
        # print('cand', cand)
        ans = False
        for c in cand:
            if c == S[: len(c)]:
                T = c
                ans = True
        if not ans:
            break
    if S == T:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    main()

def main():
    S = eval(input())
    w1 = "dream"[::-1]
    w2 = "dreamer"[::-1]
    w3 = "erase"[::-1]
    w4 = "eraser"[::-1]
    S = S[::-1]
    words = [w1, w2, w3, w4]
    flag = False
    i = 0
    while i < len(S):
        for w in words:
            if S[i:].startswith(w):
                i += len(w)
                flag = True
                break
        if not flag:
            print("NO")
            exit()
        flag = False
    print("YES")


if __name__ == "__main__":
    main()

-    # print(w1,w2,w3,w4) -    # print(S) -    # words = ['dream', 'dreamer', 'erase', 'eraser'] -    T = "" -    while S != T: -        cand = [] +    flag = False +    i = 0 +    while i < len(S): -            new_t = T + w -            cand.append(new_t) -        # print('cand', cand) -        ans = False -        for c in cand: -            if c == S[: len(c)]: -                T = c -                ans = True -        if not ans: -            break -    if S == T: -        print("YES") -    else: -        print("NO") +            if S[i:].startswith(w): +                i += len(w) +                flag = True +                break +        if not flag: +            print("NO") +            exit() +        flag = False +    print("YES")