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

string divide[4] = {"erase", "eraser", "dream", "dreamer"};

bool DFS(int i, string str){
  if (i == str.size()) return true;
  for (string s : divide) {
    if (str.substr(i, s.size()) == s) {
      if (DFS(i + s.size(), str)) return true;
    }
  }
  return false;
}

int main(){
  string str; cin >> str;
  cout << (DFS(0, str) ? "YES" : "NO") << endl;
  return 0;
}