def check(s):

    s = s.replace('eraser', '')

    s = s.replace('erase', '')

    s = s.replace('dreamer', '')

    s = s.replace('dream', '')

    if len(s) != 0:

        return 'NO'

    return 'YES'





print((check(eval(input()))))

# Me

def check(s):

    words = [

            'dream',

            'dreamer',

            'erase',

            'eraser',

            ]



    while len(s) != 0:

        flag = False

        for w in words:

            if s[-len(w):] == w:

                s = s[:-len(w)]

                flag = True

                break

        if not flag:

            return 'NO'

    return 'YES'





print((check(eval(input()))))
def check(s):
    s = s.replace("eraser", "")
    s = s.replace("erase", "")
    s = s.replace("dreamer", "")
    s = s.replace("dream", "")
    if len(s) != 0:
        return "NO"
    return "YES"


print((check(eval(input()))))

# Me
def check(s):
    words = [
        "dream",
        "dreamer",
        "erase",
        "eraser",
    ]
    while len(s) != 0:
        flag = False
        for w in words:
            if s[-len(w) :] == w:
                s = s[: -len(w)]
                flag = True
                break
        if not flag:
            return "NO"
    return "YES"


print((check(eval(input()))))

+# Me -    s = s.replace("eraser", "") -    s = s.replace("erase", "") -    s = s.replace("dreamer", "") -    s = s.replace("dream", "") -    if len(s) != 0: -        return "NO" +    words = [ +        "dream", +        "dreamer", +        "erase", +        "eraser", +    ] +    while len(s) != 0: +        flag = False +        for w in words: +            if s[-len(w) :] == w: +                s = s[: -len(w)] +                flag = True +                break +        if not flag: +            return "NO"