
function Main(input) {
    var S = input[0].toString();

    var reverseS = S.split('').reverse().join('');

    var WORDS = ['dream', 'dreamer', 'erase', 'eraser']
        .map(s => {
            return s.split('').reverse().join('');
        })

    var stringNum = 0;

    while(stringNum < reverseS.length) {
        var word = WORDS.find(w => {
            return reverseS.startsWith(w, stringNum);
        })
        if (!word) {
            return console.log('NO');
        } else {
            stringNum += word.length;
        }
    }

    console.log('YES');
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));