import std.functional,
       std.algorithm,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv;

bool chmax(t)(ref t a, t b) {
  if (a < b) {
    a = b;
    return true;
  } else {
    return false;
  }
}

T maxElement(T)(T[] arr) {
  T val = T.min;

  foreach (e; arr) {
    chmax(val, e);
  }

  return val;
}

void main() {
  string[] ws = ["dream", "dreamer", "erase", "eraser"];
  ulong[] wlens = ws.map!(w => w.length).array;
  size_t max_len = wlens.maxElement;
  string S = readln.chomp;
  string buf;
  bool flag;

  foreach_reverse (c; S) {
    flag = false;
    buf = c ~ buf;

    size_t blen = buf.length;

    if (wlens.any!(len => len == blen)) {
      foreach (w; ws) {
        if (w == buf) {
          flag = true;
          break;
        }
      }

      if (flag) {
        buf = "";
      }
    }

    if (blen == max_len) {
      buf = "";
    }
  }
  
  if (flag) {
    writeln("YES");
  } else {
    writeln("NO");
  }
}
