'use strict'

function main(input) {
  let s = input

  while(true) {
    if (s.endsWith('dream') || s.endsWith('erase')) {
      s = s.slice(0, -5)
    } else if (s.endsWith('eraser')) {
      s = s.slice(0, -6)
    } else if (s.endsWith('dreamer'))  {
      s = s.slice(0, -7)
    } else {
      break
    }
  }

  if (s.length === 0) {
    console.log('YES')
  } else {
    console.log('NO')
  }
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));