#include <bits/stdc++.h>
 
#define infi            5e9
#define infl            5e18
#define MX              100005
#define pi              2*acos(0.0)
#define ll              long long int
#define rr              read()
#define ff              first
#define ss              second
#define pb              push_back
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define ms(a,b)         memset(a, b, sizeof(a))
#define loop(i,n)       for(register int i=0;i<n;i++)
#define pool(i,n)       for(register int i=n-1;i>=0;i--)
#define loop1(i,n)      for(register int i=1;i<=n;i++)
#define pool1(i,n)      for(register int i=n;i>0;i--)
 
using namespace std;
 
inline ll read(){char c=getchar();ll num,sign=1;for(;c<'0'||c>'9';c=getchar())if(c=='-')sign=-1;for(num=0;c>='0'&&c<='9';){c-='0';num=num*10+c;c=getchar();}return num*sign;}
// inline ll pw(ll b, ll p){ll ans=1;while(p>0){if(p&1)ans*=b;p>>=1;b*=b;}return ans;}
inline bool isPrime(ll n){if(n==1)return false;if(n==2)return true;if(!(n%2))return false;for(ll i=3;i<=sqrt(n);i+=2)if(!(n%i))return false;return true;}
// inline ll gcd(ll a, ll b){if(a==0)return b;return gcd(b%a,a);}
 
// //*************************************  Bitmask Opereations  **********************************//
// int Set(int N,int pos){return N=N | (1<<pos);}
// int reset(int N,int pos){return N= N & ~(1<<pos);}
// bool check(int N,int pos){return (bool)(N & (1<<pos));}
// //********************************************************************************************//
 
// #define NN 1005
// #define KK 105
 
// queue< pair<int,int> > qq;
// vector<int>vec[NN];
// int pep[KK],dis[NN];
// bool vis[NN][KK];
// int n,k,m;
 
// void BFS(){
 
//     int v,u,p;
//     while(!qq.empty()){
//         u=qq.front().ff;
//         p=qq.front().ss;
//         qq.pop();
 
//         loop(i, vec[u].size()){
//             v=vec[u][i];
//             if(!vis[v][p]){
//                 vis[v][p]=true;
//                 dis[v]++;
//                 qq.push({v,p});
//             }
//         }
//     }
   
// }


vector<int>v,factor;
bool prime[1100];
 
void sieve(){
    prime[0]=1;

    for(int i=2; i<1100;){
        v.pb(i);
        
        for(int j=i+i; j<1100; j+=i)prime[j]=1;

        for(++i;; i++)
            if(!prime[i])
                break;
    }
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    //#ifdef rid.dle//freopen("in.txt", "r", stdin);//#endif
    //freopen("in.txt", "r", stdin);

    // sieve();
    // loop(i,10)cout << prime[i] << endl;
 
    // int test=rr;
    // loop1(tt,test){
    //     int a=rr,b=rr;
    //     bool flag=true;
    //     for(register int i=a-1;i>1;i--){
    //         if(isPrime(i)){
    //             if((b-a)%i==0){
    //                 cout << "Case " << tt << ": " << (b-a)/i << endl;
    //                 flag=false;
    //                 break;
    //             }
    //         }
    //     }
    //     if(flag)cout << "Case " << tt << ": " << -1 << endl;
    // }

    char str[MX];
    int dp[MX];
    scanf("%s", str+1); 
    int n = strlen(str+1);

    dp[0]=1;
    loop1(i,n){
        if(i>=5 && str[i-4]=='d' && str[i-3]=='r' && str[i-2]=='e' && str[i-1]=='a' && str[i]=='m')dp[i]|=dp[i-5];
        if(i>=7 && str[i-6]=='d' && str[i-5]=='r' && str[i-4]=='e' && str[i-3]=='a' && str[i-2]=='m' && str[i-1]=='e' && str[i]=='r')dp[i]|=dp[i-7];
        if(i>=5 && str[i-4]=='e' && str[i-3]=='r' && str[i-2]=='a' && str[i-1]=='s' && str[i]=='e')dp[i]|=dp[i-5];
        if(i>=6 && str[i-5]=='e' && str[i-4]=='r' && str[i-3]=='a' && str[i-2]=='s' && str[i-1]=='e' && str[i]=='r')dp[i]|=dp[i-6];
    }

    cout << (dp[n]?"YES":"NO") << endl;
    return 0;
}

Measured memory_bytes: 768