output_description: If it is possible to obtain S = T, print `YES`. Otherwise, print `NO`.
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      S
attempt: s = input()
  x = 0
  a = s.count("dream")
  b = s.count("dreamer")
  c = s.count("erase")
  d = s.count("eraser")
  reigai1 = s.count("dreamerase")
  reigai2 = s.count("dreameraser")
  reigai1 = reigai1 - reigai2
  b = b - reigai1 - reigai2
  a = a - reigai1 - reigai2
  c = c - reigai1 - reigai2
  d = d - reigai2
  a2 = a - b
  c2 = c - d
  # print(a,b,c,d)
  # print(a2,c2)
  # print(reigai1,reigai2)
  # print(a2*5+b*7+c2*5+d*6+reigai1*10+reigai2*11)
  if a2 * 5 + b * 7 + c2 * 5 + d * 6 + reigai1 * 10 + reigai2 * 11 == len(s):
      print("YES")
  else:
      print("NO")
  
problem_description: Statement
  
  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`.
samples: [{"input": "erasedream", "output": "YES\n    \n\nAppend `erase` and `dream` at the end of T in this order, to obtain S = T.\n\n* * *"}, {"input": "dreameraser", "output": "YES\n    \n\nAppend `dream` and `eraser` at the end of T in this order, to obtain S = T.\n\n* * *"}, {"input": "dreamerer", "output": "NO"}]