function Main(input) {
  const arr = ['dream','dreamer','erase','eraser'];
  const rev = str => [...str].reduce((prev, curr) => curr + prev);
  const arrRev = arr.map(rev);
  const inputRev = rev(input);

  function reducer(str) {
    if (str === '') {
      console.log('YES');
      return;
    }
    const target = str.slice(0, 7);
    const arrFiltered = arrRev.filter(word => target.indexOf(word) === 0);

    if (arrFiltered.length === 0) {
      console.log('NO');
      return;
    } else {
      const len = arrFiltered[0].length;
      const sub = str.substring(len);
      reducer(sub);
    }
  }

  reducer(inputRev);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));