import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
  String s = sc.next();
  s = s.replace("eraser","*");
  s = s.replace("erase","*");
  s = s.replace("dreamer","*");
  s = s.replace("dream","*");
  s = s.replace("*","");
  System.out.println(s.equals("") ? "YES":"NO");
}} import java.util.*; util.* java public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
  String s = sc.next();
  s = s.replace("eraser","*");
  s = s.replace("erase","*");
  s = s.replace("dreamer","*");
  s = s.replace("dream","*");
  s = s.replace("*","");
  System.out.println(s.equals("") ? "YES":"NO");
}} Main public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
  String s = sc.next();
  s = s.replace("eraser","*");
  s = s.replace("erase","*");
  s = s.replace("dreamer","*");
  s = s.replace("dream","*");
  s = s.replace("*","");
  System.out.println(s.equals("") ? "YES":"NO");
} main {
Scanner sc = new Scanner(System.in);
  String s = sc.next();
  s = s.replace("eraser","*");
  s = s.replace("erase","*");
  s = s.replace("dreamer","*");
  s = s.replace("dream","*");
  s = s.replace("*","");
  System.out.println(s.equals("") ? "YES":"NO");
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc s = s.replace("eraser","*") s s.replace("eraser","*") s.replace s "eraser" "*" s = s.replace("erase","*") s s.replace("erase","*") s.replace s "erase" "*" s = s.replace("dreamer","*") s s.replace("dreamer","*") s.replace s "dreamer" "*" s = s.replace("dream","*") s s.replace("dream","*") s.replace s "dream" "*" s = s.replace("*","") s s.replace("*","") s.replace s "*" "" System.out.println(s.equals("") ? "YES":"NO") System.out.println System.out System System.out s.equals("") ? "YES":"NO" s.equals("") s.equals s "" "YES" "NO" String args[] args public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
  String s = sc.next();
  s = s.replace("eraser","*");
  s = s.replace("erase","*");
  s = s.replace("dreamer","*");
  s = s.replace("dream","*");
  s = s.replace("*","");
  System.out.println(s.equals("") ? "YES":"NO");
}} public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
  String s = sc.next();
  s = s.replace("eraser","*");
  s = s.replace("erase","*");
  s = s.replace("dreamer","*");
  s = s.replace("dream","*");
  s = s.replace("*","");
  System.out.println(s.equals("") ? "YES":"NO");
}} Main
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
  String s = sc.next();
  s = s.replace("eraser","*");
  s = s.replace("erase","*");
  s = s.replace("dreamer","*");
  s = s.replace("dream","*");
  s = s.replace("*","");
  System.out.println(s.equals("") ? "YES":"NO");
}}