#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define SZ(x) ((ll)(x).size())
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

string s;

int main(){
    cin >> s;
    int n = s.size();
    int index = 0;
    vector<string> d = {"dream","dreamer","erase","eraser"};
    bool pred = false;
    bool pree = false;
    while(index<n){
        if(pred){
            if(index+1<n){
                if(s[index]=='e'&&s[index+1]=='r'){
                    if(index+2==n){
                        put("YES");
                        return 0;
                    }else{
                        if(s[index+2]=='a'){
                            pred = pree = false;
                            continue;
                        }else{
                            index += 2;
                            if(index==n){
                                put("YES");
                                return 0;
                            }
                            pred = pree = false;
                            continue;
                        }
                    }
                }else{
                    pree = pred = false;
                    continue;
                }
            }else{
                put("NO");
                return 0;
            }
        }else if(pree){
            if(s[index]=='r'){
                index++;
                if(index==n){
                    put("YES");
                    return 0;
                }
                pree = false;
                pred = false;
                continue;
            }else{
                pree = false;
                pred = false;
                continue;
            }
        }else{
            if(index+4<n){
                if(s[index]=='d'){
                    bool flag = true;
                    REP(i,5){
                        if(s[index+i]!=d[0][i]){
                            flag = false;
                        }
                    }
                    if(flag){
                        pred = true;
                        pree = false;
                        index += 5;
                        if(index==n){
                            put("YES");
                            return 0;
                        }
                        continue;
                    }else{
                        put("NO");
                        return 0;
                    }
                }else if(s[index]=='e'){
                    bool flag = true;
                    REP(i,5){
                        if(s[index+i]!=d[2][i]){
                            flag = false;
                        }
                    }
                    if(flag){
                        pree = true;
                        pred = false;
                        index += 5;
                        if(index==n){
                            put("YES");
                            return 0;
                        }
                        continue;
                    }else{
                        put("NO");
                        return 0;
                    }
                }else{
                    put("NO");
                    return 0;
                }
                
            }else{
                put("NO");
                return 0;
            }
        }
    }
    put("YES");
    return 0;
}


Measured memory_bytes: 512