import java.util.*;
 
public class Main{
  public static void main(String[]args){
    Scanner sc =  new Scanner(System.in);
    String S = sc.nextLine();
    S = S.replaceAll("eraser", "");
    S = S.replaceAll("erase", "");
    S = S.replaceAll("dreamer", "");
    S = S.replaceAll("dream", "");
   
    System.out.println(S.length() == 0 ? "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.nextLine();
    S = S.replaceAll("eraser", "");
    S = S.replaceAll("erase", "");
    S = S.replaceAll("dreamer", "");
    S = S.replaceAll("dream", "");
   
    System.out.println(S.length() == 0 ? "YES" : "NO");
  }
} Main public static void main(String[]args){
    Scanner sc =  new Scanner(System.in);
    String S = sc.nextLine();
    S = S.replaceAll("eraser", "");
    S = S.replaceAll("erase", "");
    S = S.replaceAll("dreamer", "");
    S = S.replaceAll("dream", "");
   
    System.out.println(S.length() == 0 ? "YES" : "NO");
  } main {
    Scanner sc =  new Scanner(System.in);
    String S = sc.nextLine();
    S = S.replaceAll("eraser", "");
    S = S.replaceAll("erase", "");
    S = S.replaceAll("dreamer", "");
    S = S.replaceAll("dream", "");
   
    System.out.println(S.length() == 0 ? "YES" : "NO");
  } Scanner sc =  new Scanner(System.in); sc new Scanner(System.in) String S = sc.nextLine(); S sc.nextLine() sc.nextLine sc S = S.replaceAll("eraser", "") S S.replaceAll("eraser", "") S.replaceAll S "eraser" "" S = S.replaceAll("erase", "") S S.replaceAll("erase", "") S.replaceAll S "erase" "" S = S.replaceAll("dreamer", "") S S.replaceAll("dreamer", "") S.replaceAll S "dreamer" "" S = S.replaceAll("dream", "") S S.replaceAll("dream", "") S.replaceAll S "dream" "" System.out.println(S.length() == 0 ? "YES" : "NO") System.out.println System.out System System.out S.length() == 0 ? "YES" : "NO" S.length() == 0 S.length() S.length S 0 "YES" "NO" String[]args args public class Main{
  public static void main(String[]args){
    Scanner sc =  new Scanner(System.in);
    String S = sc.nextLine();
    S = S.replaceAll("eraser", "");
    S = S.replaceAll("erase", "");
    S = S.replaceAll("dreamer", "");
    S = S.replaceAll("dream", "");
   
    System.out.println(S.length() == 0 ? "YES" : "NO");
  }
} public class Main{
  public static void main(String[]args){
    Scanner sc =  new Scanner(System.in);
    String S = sc.nextLine();
    S = S.replaceAll("eraser", "");
    S = S.replaceAll("erase", "");
    S = S.replaceAll("dreamer", "");
    S = S.replaceAll("dream", "");
   
    System.out.println(S.length() == 0 ? "YES" : "NO");
  }
} Main
import java.util.*;
 
public class Main{
  public static void main(String[]args){
    Scanner sc =  new Scanner(System.in);
    String S = sc.nextLine();
    S = S.replaceAll("eraser", "");
    S = S.replaceAll("erase", "");
    S = S.replaceAll("dreamer", "");
    S = S.replaceAll("dream", "");
   
    System.out.println(S.length() == 0 ? "YES" : "NO");
  }
}