#include<bits/stdc++.h>
using namespace std;

int main(){
  string divide[4] = {"erase", "eraser", "dream", "dreamer"};
  string str; cin >> str;
  vector<bool> dp(1000010);
  dp[0] = true;
  for (int i = 0; i < str.size(); i++){
    if (!dp[i]) continue;
    for (string s : divide){
      if (str.substr(i, s.size()) == s) dp[i + s.size()] = true;
    }
  }
  cout << (dp[str.size()] ? "YES" : "NO") << endl;
  return 0;
}