import sys

s = input()

ts = ['']

while True:

  nts= []

  for t in ts:

    for w in ['dreamer', 'eraser', 'dream', 'erase']:

      if s == t + w:

        print('YES')

        sys.exit()

      if s.startswith(t + w):

        nts.append(t + w)

  if len(nts) == 0:

    print('NO')

    sys.exit()

  ts = nts

from sys import exit

s = eval(input())

ts = ['']

while True:

  nts= []

  for t in ts:

    for w in ['dreamer', 'eraser', 'dream', 'erase']:

      tw = t + w

      if s == tw:

        print('YES')

        exit()

      if s.startswith(tw):

        nts.append(tw)

  if len(nts) == 0:

    print('NO')

    exit()

  ts = nts

import sys

s = input()
ts = [""]
while True:
    nts = []
    for t in ts:
        for w in ["dreamer", "eraser", "dream", "erase"]:
            if s == t + w:
                print("YES")
                sys.exit()
            if s.startswith(t + w):
                nts.append(t + w)
    if len(nts) == 0:
        print("NO")
        sys.exit()
    ts = nts

from sys import exit

s = eval(input())
ts = [""]
while True:
    nts = []
    for t in ts:
        for w in ["dreamer", "eraser", "dream", "erase"]:
            tw = t + w
            if s == tw:
                print("YES")
                exit()
            if s.startswith(tw):
                nts.append(tw)
    if len(nts) == 0:
        print("NO")
        exit()
    ts = nts

-import sys +from sys import exit -s = input() +s = eval(input()) -            if s == t + w: +            tw = t + w +            if s == tw: -                sys.exit() -            if s.startswith(t + w): -                nts.append(t + w) +                exit() +            if s.startswith(tw): +                nts.append(tw) -        sys.exit() +        exit()