'use strict'

function main(input) {
  let S = input.trim() //.split('\n')

  const words = 'dream dreamer erase eraser'.split(' ')

  while (true) {
    let found = false
    for (let i = 0; i < words.length; i++) {
      const tmp = S.match(new RegExp(words[i] + '$'))
      if (tmp) {
        const xx = -1 * tmp[0].length
        S = S.slice(0, xx)
        found = true
      }
      if (S === '') {
        console.log('YES')
        return
      }
    }
    if (!found) {
      console.log('NO')
      return
    }
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))
