'use strict'

function main(input) {
  let s = input
  s = s.split('').reverse().join('')
  let dividers = ['dream', 'erase', 'eraser', 'dreamer']
  dividers = dividers.map(divider => divider.split('').reverse().join(''))

  let result = false
  const length = s.length
  for (let i=0; i<length;) {
    let tmpResult = false
    for (let j=0; j<dividers.length; j++) {
      if (s.startsWith(dividers[j])) {
        s = s.slice(dividers[j].length)
        i += dividers[j].length
        tmpResult = true
        break
      }
    }

    if (tmpResult === false) {
      break
    }
    if (s.length === 0) {
      result = true 
      break
    }

  }

  if (result) {
    console.log('YES')
  } else {
    console.log('NO')
  }
}

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