#include <iostream>
#include <string>
using namespace std;
 
string divide[4] = {"dream", "dreamer", "erase", "eraser"};
bool dp[100010];
 
int main() {
    string S;
    cin >> S;
 
    dp[0] = 1;
    for(int i = 0; i < S.size(); ++i){
        for(string s : divide){
            if(S.substr(i, s.size()) == s){ // うまく切れたら先に進む
                dp[i + s.size()] = dp[i];
            }
        }
    }
    cout << (dp[S.size()] ? "YES" : "NO") << endl;
    return 0;
}