"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const S = arg[0].split("");
    const reversed = [...S].reverse();
    
    let temp = [];
    
    while(S.length > 0) {
        if(S.slice(-5).join("") === "erase" || S.slice(-5).join("") === "dream") {
            S.splice(S.length - 5, 5);
        } else if(S.slice(-6).join("") === "eraser" || S.slice(-6).join("") === "dreamer") {
            S.splice(S.length - 6, 6);
        } else {
            console.log("NO");
            return;
        }
    }
    
    console.log("YES");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));