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: dr ="dream" 
  dre = "dreamer" 
  er ="erase" 
  ere = "eraser" 
  a = input()
  ret = "YES"
  while len(a) != 0:
      if (a.endswith(dr) or a.endswith(er)):
          a = a[:len(a)-5]
      elif(a.endswith(dre) ):
          a = a[:len(a)-7]
  	elif(a.endswith(ere)):
          a = a[:len(a)-6]
      else:
          ret = "NO"
          break
          
  print(ret)
  
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"}]