function Main(input) {
  const s = input;
  let t = "";
  const t_holder = ['dream','dreamer','erase','eraser']
  const t_check_count = t_holder.length;
  let ans = "NO";

  string_check: {
    for (var t_check_index = 0; t_check_index < t_check_count; t_check_index++) {
      let s_work = s;
      ans = stringcheck(t_holder,s_work);
      if (ans === "YES") {
        break string_check;
      }
      t_holder.push(t_holder[0]);
      t_holder.shift();
    }
  }
  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

function stringcheck(t_holder,s_work) {
  for (var t_h_index = 0; t_h_index < t_holder.length; t_h_index++) {
    while (s_work.indexOf(t_holder[t_h_index]) >= 0) {
      let s_check = s_work.indexOf(t_holder[t_h_index]);
      if (s_check >= 0) {
        s_work = s_work.replace(t_holder[t_h_index],"")
      }
    }
  }
  if (s_work.length === 0) {
    return "YES";
  } else {
    return "NO";
  }
}
