function reverse(s) {
  return s.split('').reverse().join('');
}

function r_search(input){
  const words = ['dreamer', 'dream', 'eraser', 'erase'];

  return words.map(x => reverse(x)
    ).map( word => {
    if(input.startsWith(word)){
      if(input == word){return true;}
      if(input.length - word.length <= 0){return false;}
      return r_search(input.substring(word.length))
    }
  }).some(x => x)
}

function main(input) {
    console.log(input);
  if(r_search(reverse(input))){
    console.log('YES');
  }else{
    console.log('NO');
  }
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));