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: d = {"dream": 5, "dreamer": 7, "erase": 5, "eraser": 6}
  st = input().strip()
  cnt = 0
  if st.find("dream") != -1:
      cnt += st.count("dream") * d["dream"]
  if st.find("dreamer") != -1:
      cnt += st.count("dreamer") * d["dreamer"]
  if st.find("erase") != -1:
      cnt += st.count("erase") * d["erase"]
  if st.find("eraser") != -1:
      cnt += st.count("eraser") * d["eraser"]
  print("YES" if cnt == len(st) else "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"}]