"use strict";

function main(input){
  const args = input.trim();
  const WORDS = ["dream","dreamer","erase","eraser"].map(_=>_.split('').reverse().join("")); 
  const s = args.split('').reverse().join(""); 
  
  let idx = 0;
  while(true){
    var w = WORDS.find(_=> s.startsWith(_, idx));
    if(!w) break;
    idx += w.length;
  }
  console.log(idx === s.length ? "YES" : "NO");
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));  