
'use strict';
function main(input) {
    var args = input.trim().split('\n')[1].split(' ').map((n) => parseInt(n, 10));
  let str = args[0]
  let beflen = args[0].length
  let aftlen = 0
  let result = 'NO'
  if (beflen <= 7) console.log(result)
  while(beflen !== aftlen) {
    str = str.replace(/(dream|dreamer|erase|eraser)/, '');
    if(str === '') {
      result = 'YES'
      console.log(result)
    }
  }
  if (result = 'NO') console.log('result')
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));