def main():

  s = eval(input())

  dream = False

  erase = False



  while s:

    if s.startswith('dream'):

      s = s[5:]

      dream = True

      erase = False

    elif s.startswith('erase'):

      s = s[5:]

      dream = False

      erase = True

    elif s.startswith('er') and dream:

      s = s[2:]

      dream = False

    elif s.startswith('r') and erase:

      s = s[1:]

      erase = False

    else:

      return False

  

  return True



if main():

  print('YES')

else:

  print('NO')
# dfs

import sys

sys.setrecursionlimit(10**6)



C = ['dream', 'dreamer', 'erase', 'eraser']

S = eval(input())

L = len(S)





def dfs(x, l):

    if l == L:

        return True

    elif l > L:

        return False



    match = S[l:l+7]

    for c in C:

        if match.find(c) == 0:

            if dfs(c, l+len(c)):

                return True

    return False





print(('YES' if dfs('', 0) else 'NO'))

def main():
    s = eval(input())
    dream = False
    erase = False
    while s:
        if s.startswith("dream"):
            s = s[5:]
            dream = True
            erase = False
        elif s.startswith("erase"):
            s = s[5:]
            dream = False
            erase = True
        elif s.startswith("er") and dream:
            s = s[2:]
            dream = False
        elif s.startswith("r") and erase:
            s = s[1:]
            erase = False
        else:
            return False
    return True


if main():
    print("YES")
else:
    print("NO")

# dfs
import sys

sys.setrecursionlimit(10**6)
C = ["dream", "dreamer", "erase", "eraser"]
S = eval(input())
L = len(S)


def dfs(x, l):
    if l == L:
        return True
    elif l > L:
        return False
    match = S[l : l + 7]
    for c in C:
        if match.find(c) == 0:
            if dfs(c, l + len(c)):
                return True
    return False


print(("YES" if dfs("", 0) else "NO"))

-def main(): -    s = eval(input()) -    dream = False -    erase = False -    while s: -        if s.startswith("dream"): -            s = s[5:] -            dream = True -            erase = False -        elif s.startswith("erase"): -            s = s[5:] -            dream = False -            erase = True -        elif s.startswith("er") and dream: -            s = s[2:] -            dream = False -        elif s.startswith("r") and erase: -            s = s[1:] -            erase = False -        else: -            return False -    return True +# dfs +import sys + +sys.setrecursionlimit(10**6) +C = ["dream", "dreamer", "erase", "eraser"] +S = eval(input()) +L = len(S) -if main(): -    print("YES") -else: -    print("NO") +def dfs(x, l): +    if l == L: +        return True +    elif l > L: +        return False +    match = S[l : l + 7] +    for c in C: +        if match.find(c) == 0: +            if dfs(c, l + len(c)): +                return True +    return False + + +print(("YES" if dfs("", 0) else "NO"))