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

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

T minElement(T)(T[] arr) {
  T val = T.max;

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

  return val;
}

void main() {
  string[] ws = ["dream", "dreamer", "erase", "eraser"].map!(w => w.retro).array.to!(string[]);
  string S = readln.chomp.retro.to!string;
  bool flag;

  while (S.length > ws.map!(w => w.length).array.minElement) {
    size_t len;

    foreach (w; ws) {
      if (S.startsWith(w)) {
        flag = true;
        len = w.length;
        break;
      } else {
        flag = false;
      }
    }

    if (flag) {
      S = S[0..len];
    }
  }

  if (flag) {
    writeln("YES");
  } else {
    writeln("NO");
  }
}
