function Main(input) {
  const reverse = (s) => {
      return s.split('').reverse().join('');
  };

  const S = input;
  const t_holder = ['dream','dreamer','erase','eraser'].map(reverse);

  let s_work = reverse(S);
  console.log(stringcheck(t_holder,s_work));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

function stringcheck(t_holder,s_work) {
  let s_index = 0;
  let search_end = 0;
  while (search_end === 0) {
    let index = search(t_holder,s_work.slice(s_index));
    if (index) {
      s_index += index
    } else {
      search_end = 1;
    }
  }
  if (s_work.length === s_index) {
    return "YES";
  } else {
    return "NO";
  }
}

function search(t_holder,s_work) {
  for (var t_holder_index = 0; t_holder_index < t_holder.length; t_holder_index++) {
    if (t_holder[t_holder_index] === s_work.slice(0,t_holder[t_holder_index].length)) {
      return t_holder[t_holder_index].length;
    }
  }
  return false;
}
