"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const S = arg[0];
    const reversed = [...S].reverse();
    
    let temp = [];
    
    for(let i in reversed) {
        temp.push(reversed[i]);
        if(
            temp.reverse().join("") === "dream" ||
            temp.reverse().join("") === "dreamer" ||
            temp.reverse().join("") === "erase" ||
            temp.reverse().join("") === "eraser"
        ) {
            temp = [];
        }
    }
    
    console.log(temp.length === 0 ? "YES" : "NO");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));