from collections import defaultdict





def main():

    S = eval(input())

    while len(S) != 0:

        change = False

        for s in ["dream", "dreamer", "erase", "eraser"]:

            if S.endswith(s):

                S = S[:-len(s)]

                change = True

                break

        if not change:

            break



    print(("YES" if len(S) == 0 else "NO"))





if __name__ == '__main__':

    main()

from collections import defaultdict, Counter

from itertools import product, groupby, count, permutations, combinations

from math import pi, sqrt

from collections import deque

from bisect import bisect, bisect_left, bisect_right

from string import ascii_lowercase

from functools import lru_cache

import sys

sys.setrecursionlimit(10000)

INF = float("inf")

YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"

dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]

dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]





def inside(y, x, H, W):

    return 0 <= y < H and 0 <= x < W





def ceil(a, b):

    return (a + b - 1) // b





def main():

    S = eval(input())

    i = len(S)

    while i > 0:

        ok = False

        for x in ["dreamer", "eraser", "dream", "erase"]:

            if S.startswith(x, i - len(x)):

                i -= len(x)

                ok = True

                break

        if not ok:

            print(NO)

            return

    print(YES)





if __name__ == '__main__':

    main()

from collections import defaultdict


def main():
    S = eval(input())
    while len(S) != 0:
        change = False
        for s in ["dream", "dreamer", "erase", "eraser"]:
            if S.endswith(s):
                S = S[: -len(s)]
                change = True
                break
        if not change:
            break
    print(("YES" if len(S) == 0 else "NO"))


if __name__ == "__main__":
    main()

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys

sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    S = eval(input())
    i = len(S)
    while i > 0:
        ok = False
        for x in ["dreamer", "eraser", "dream", "erase"]:
            if S.startswith(x, i - len(x)):
                i -= len(x)
                ok = True
                break
        if not ok:
            print(NO)
            return
    print(YES)


if __name__ == "__main__":
    main()

-from collections import defaultdict +from collections import defaultdict, Counter +from itertools import product, groupby, count, permutations, combinations +from math import pi, sqrt +from collections import deque +from bisect import bisect, bisect_left, bisect_right +from string import ascii_lowercase +from functools import lru_cache +import sys + +sys.setrecursionlimit(10000) +INF = float("inf") +YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no" +dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0] +dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1] + + +def inside(y, x, H, W): +    return 0 <= y < H and 0 <= x < W + + +def ceil(a, b): +    return (a + b - 1) // b -    while len(S) != 0: -        change = False -        for s in ["dream", "dreamer", "erase", "eraser"]: -            if S.endswith(s): -                S = S[: -len(s)] -                change = True +    i = len(S) +    while i > 0: +        ok = False +        for x in ["dreamer", "eraser", "dream", "erase"]: +            if S.startswith(x, i - len(x)): +                i -= len(x) +                ok = True -        if not change: -            break -    print(("YES" if len(S) == 0 else "NO")) +        if not ok: +            print(NO) +            return +    print(YES)