function main(input){
  var reverse = (s) => {
    s.split('').reverse().join('');
  };
  var S = input;
  var args = ["dream","dreamer","erase","eraser"];
  var revS = reverse(S);
  var revArgs = args.map((val) => {
    return reverse(val);
  });
  var index = 0;

  while(true){
    var w = revArgs.find((w) => revS.startsWith(w,index));
    if(!w) break;
    index += w.length;
  }

  if(S.length === index){
    console.log("YES");
  }else{
    console.log("NO");
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));