import std.array;
import std.range;
import std.algorithm;
import std.conv;
import std.stdio;
import std.string;

void main(string[] args) {
    string s = readln.chomp;

    string[] words = ["dream", "dreamer", "erase", "eraser"];
    bool ans = false;

    loop: while (true) {
        if (s.length <= 0) {
            ans = true;
            break loop;
        } else {
            foreach (word; words) {
                if (s.endsWith(word)) {
                    s = s[0..($-word.length)];
                    continue loop;
                }
            }
            break loop;
        }
    }

    (ans ? "YES" : "NO").writeln;
}