console.log((S=>{
  let T = S;
  do {
    S = T;
    T = S.replace(/(dream|dreamer|erase|eraser)$/,'');
  } while ( T.length < S.length );
  return T?'NO':'YES';
})(require('fs').readFileSync('/dev/stdin', 'utf8')));
