function main(input) {
    let S = input;
    const key = ['dream', 'dreamer', 'erase', 'eraser'];
    while( key.some( key => S.endsWith(key)) ) {
        key.filter( key => S.endsWith(key) ).forEach( key => {
            S = S.substring(0, S.length - key.length);
        })
    }

    if( S === '' ) {
        console.log('YES');
    } else {
        console.log('NO');
    }
}

main( require('fs').readFileSync('/dev/stdin', 'utf8') );