"use strict";
const main = arg => {
  let word = arg.trim().split("").reverse().join('');
  let dream = "dream".split("").reverse().join('');
  let dreamer = "dreamer".split("").reverse().join('');
  let erase = "erase".split("").reverse().join('');
  let eraser = "eraser".split("").reverse().join('');
  let judge = "YES";
  let isNeedLoop = true;
  while(isNeedLoop){
    if(word.startsWith(dream) ){
      word = word.slice(5);
    } else if(word.startsWith(dreamer)){
      word = word.slice(7);
    } else if(word.startsWith(erase)){
      word = word.slice(5);  
    } else if(word.startsWith(eraser)){
      word = word.slice(6);
    } else if(word == ""){
      	isNeedLoop = false;
    } else {
      	judge = "NO"
		isNeedLoop = false;
    }
  }
  console.log(judge);
}

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