You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:    * Append one of the following at the end of T: `dream`, `dreamer`, `erase` and `eraser`.
S = list(input().split())
S.reverse()
T = []
n = len(S)
for i in range(n):
  T.append(S[i])
  mojiretu = ','.join(T)
  if mojiretu == ["maerd"] or mojiretu == ["remaerd"] or mojiretu == ["esare"] or mojiretu == ["resare"]:
    T =[]
if len(T) == 0:
  print("YES")
else:
  print("NO")

S = input()
S = list(S)
S.reverse()
T = []
n = len(S)
for i in range(n):
  T.append(S[i])
  mojiretu = ''.join(T)
  m = len(mojiretu)
  if mojiretu == "maerd" or mojiretu == "remaerd" or mojiretu == "esare" or mojiretu == "resare":
    T =[]
  elif m==8:
      break
N = len(T)
if N == 0:
  print("YES")
else:
  print("NO")
