'use strict'

function main(input) {
  let s = input
  let result = ''

  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 if (s.length === 0){
      result = 'YES'
      break
    } else {
      result = 'NO'
      break
    }
  }

  console.log(result)
}

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