'use strict';
function main(input) {
    var reverse = input.trim().split('').reverse().join('')
    var words = ['dream', 'dreamer', 'erase' ,'eraser']
    var rws = words.map(a=>a.split('').reverse().join(''))
    let index = 0
	while (true) {
      const f = rws.find(a=>reverse.startsWith(a,index))
      if(!f) break
      index = index + f.length
    }
    if(index === rws.length) {
      console.log('YES')
    }else{
      console.log('NO')
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));