function main( input ) {
    const reverse = (s) => {
        return s.split('').reverse().join('');
    }

    const WORDS = ['dream', 'dreamer', 'erase', 'eraser'].map(reverse);
    const S = reverse(input.split('\n')[0]);

    let index = 0;
    while(true) {
        let w = WORDS.find( (w) => S.startsWith(w, index) );
        if(!w) break;
        index += w.length;
    }

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

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