import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

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

public class Main {
	static String[] str = {
		"eraser",
		"erase",
		"dreamer",
		"dream",
	};
	
	public static void main (String[] args) {
   	 Scanner sc = new Scanner(System.in);
   	 String S = sc.nextLine();
   	 S = S.replaceAll(str[0], "-");
   	 S = S.replaceAll(str[1], "-");
   	 S = S.replaceAll(str[2], "-");
   	 S = S.replaceAll(str[3], "-");
   	 S = S.replaceAll("-", "");
   	 if(S.length() == 0) {
   		 System.out.println("YES");
   	 } else {
   		 System.out.println("NO");   		 
   	 }
    }
}
