import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    String s = sc.next();

    String[] words = {"dream", "dreamer", "erase", "eraser"};

    if (dfs(s, 0, words)) {
      os.println("YES");
    } else {
      os.println("NO");
    }
  }

  private static boolean dfs(String s, int index, String[] words) {
    if (index == s.length()) return true;
    boolean res = false;
    for (String w : words) {
      String t = s.substring(index, Math.min(index + w.length(), s.length()));
      if (t.equals(w)) {
        res |= dfs(s, index + w.length(), words);
      }
    }
    return res;
 }
} import java.io.InputStream; InputStream java.io import java.io.PrintStream; PrintStream java.io import java.util.*; util.* java public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    String s = sc.next();

    String[] words = {"dream", "dreamer", "erase", "eraser"};

    if (dfs(s, 0, words)) {
      os.println("YES");
    } else {
      os.println("NO");
    }
  }

  private static boolean dfs(String s, int index, String[] words) {
    if (index == s.length()) return true;
    boolean res = false;
    for (String w : words) {
      String t = s.substring(index, Math.min(index + w.length(), s.length()));
      if (t.equals(w)) {
        res |= dfs(s, index + w.length(), words);
      }
    }
    return res;
 }
} Main public static void main(String[] args) {
    solve(System.in, System.out);
  } main {
    solve(System.in, System.out);
  } solve(System.in, System.out) solve System.in System System.in System.out System System.out String[] args args static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    String s = sc.next();

    String[] words = {"dream", "dreamer", "erase", "eraser"};

    if (dfs(s, 0, words)) {
      os.println("YES");
    } else {
      os.println("NO");
    }
  } solve {
    Scanner sc = new Scanner(is);

    /* read */
    String s = sc.next();

    String[] words = {"dream", "dreamer", "erase", "eraser"};

    if (dfs(s, 0, words)) {
      os.println("YES");
    } else {
      os.println("NO");
    }
  } Scanner sc = new Scanner(is); sc new Scanner(is) String s = sc.next(); s sc.next() sc.next sc String[] words = {"dream", "dreamer", "erase", "eraser"}; words {"dream", "dreamer", "erase", "eraser"} "dream" "dreamer" "erase" "eraser" if (dfs(s, 0, words)) {
      os.println("YES");
    } else {
      os.println("NO");
    } dfs(s, 0, words) dfs s 0 words {
      os.println("YES");
    } os.println("YES") os.println os "YES" {
      os.println("NO");
    } os.println("NO") os.println os "NO" InputStream is is PrintStream os os private static boolean dfs(String s, int index, String[] words) {
    if (index == s.length()) return true;
    boolean res = false;
    for (String w : words) {
      String t = s.substring(index, Math.min(index + w.length(), s.length()));
      if (t.equals(w)) {
        res |= dfs(s, index + w.length(), words);
      }
    }
    return res;
 } dfs {
    if (index == s.length()) return true;
    boolean res = false;
    for (String w : words) {
      String t = s.substring(index, Math.min(index + w.length(), s.length()));
      if (t.equals(w)) {
        res |= dfs(s, index + w.length(), words);
      }
    }
    return res;
 } if (index == s.length()) return true; index == s.length() index s.length() s.length s return true; true boolean res = false; res false for (String w : words) {
      String t = s.substring(index, Math.min(index + w.length(), s.length()));
      if (t.equals(w)) {
        res |= dfs(s, index + w.length(), words);
      }
    } String w words {
      String t = s.substring(index, Math.min(index + w.length(), s.length()));
      if (t.equals(w)) {
        res |= dfs(s, index + w.length(), words);
      }
    } {
      String t = s.substring(index, Math.min(index + w.length(), s.length()));
      if (t.equals(w)) {
        res |= dfs(s, index + w.length(), words);
      }
    } String t = s.substring(index, Math.min(index + w.length(), s.length())); t s.substring(index, Math.min(index + w.length(), s.length())) s.substring s index Math.min(index + w.length(), s.length()) Math.min Math index + w.length() index w.length() w.length w s.length() s.length s if (t.equals(w)) {
        res |= dfs(s, index + w.length(), words);
      } t.equals(w) t.equals t w {
        res |= dfs(s, index + w.length(), words);
      } res |= dfs(s, index + w.length(), words) res dfs(s, index + w.length(), words) dfs s index + w.length() index w.length() w.length w words return res; res String s s int index index String[] words words public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    String s = sc.next();

    String[] words = {"dream", "dreamer", "erase", "eraser"};

    if (dfs(s, 0, words)) {
      os.println("YES");
    } else {
      os.println("NO");
    }
  }

  private static boolean dfs(String s, int index, String[] words) {
    if (index == s.length()) return true;
    boolean res = false;
    for (String w : words) {
      String t = s.substring(index, Math.min(index + w.length(), s.length()));
      if (t.equals(w)) {
        res |= dfs(s, index + w.length(), words);
      }
    }
    return res;
 }
} public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    String s = sc.next();

    String[] words = {"dream", "dreamer", "erase", "eraser"};

    if (dfs(s, 0, words)) {
      os.println("YES");
    } else {
      os.println("NO");
    }
  }

  private static boolean dfs(String s, int index, String[] words) {
    if (index == s.length()) return true;
    boolean res = false;
    for (String w : words) {
      String t = s.substring(index, Math.min(index + w.length(), s.length()));
      if (t.equals(w)) {
        res |= dfs(s, index + w.length(), words);
      }
    }
    return res;
 }
} Main
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    String s = sc.next();

    String[] words = {"dream", "dreamer", "erase", "eraser"};

    if (dfs(s, 0, words)) {
      os.println("YES");
    } else {
      os.println("NO");
    }
  }

  private static boolean dfs(String s, int index, String[] words) {
    if (index == s.length()) return true;
    boolean res = false;
    for (String w : words) {
      String t = s.substring(index, Math.min(index + w.length(), s.length()));
      if (t.equals(w)) {
        res |= dfs(s, index + w.length(), words);
      }
    }
    return res;
 }
}
