import java.util.Scanner;

class Main{
	public static void main(String[]$){
		Scanner s=new Scanner(System.in);
		StringBuilder str=new StringBuilder(s.next()
				.replaceAll("eraser","")
				.replaceAll("dream","D")
				.replaceAll("er","R")
				.replaceAll("as","A"));
		String[] m={"RAe","DR","D"};
		loop:
		while(true){
			for(String b:m){
				if(str.toString().endsWith(b)){
					str.delete(str.length()-b.length(),str.length());
					continue loop;
				}
			}
			break;
		}
		System.out.println(str.length()==0?"YES":"NO");
	}
} import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[]$){
		Scanner s=new Scanner(System.in);
		StringBuilder str=new StringBuilder(s.next()
				.replaceAll("eraser","")
				.replaceAll("dream","D")
				.replaceAll("er","R")
				.replaceAll("as","A"));
		String[] m={"RAe","DR","D"};
		loop:
		while(true){
			for(String b:m){
				if(str.toString().endsWith(b)){
					str.delete(str.length()-b.length(),str.length());
					continue loop;
				}
			}
			break;
		}
		System.out.println(str.length()==0?"YES":"NO");
	}
} Main public static void main(String[]$){
		Scanner s=new Scanner(System.in);
		StringBuilder str=new StringBuilder(s.next()
				.replaceAll("eraser","")
				.replaceAll("dream","D")
				.replaceAll("er","R")
				.replaceAll("as","A"));
		String[] m={"RAe","DR","D"};
		loop:
		while(true){
			for(String b:m){
				if(str.toString().endsWith(b)){
					str.delete(str.length()-b.length(),str.length());
					continue loop;
				}
			}
			break;
		}
		System.out.println(str.length()==0?"YES":"NO");
	} main {
		Scanner s=new Scanner(System.in);
		StringBuilder str=new StringBuilder(s.next()
				.replaceAll("eraser","")
				.replaceAll("dream","D")
				.replaceAll("er","R")
				.replaceAll("as","A"));
		String[] m={"RAe","DR","D"};
		loop:
		while(true){
			for(String b:m){
				if(str.toString().endsWith(b)){
					str.delete(str.length()-b.length(),str.length());
					continue loop;
				}
			}
			break;
		}
		System.out.println(str.length()==0?"YES":"NO");
	} Scanner s=new Scanner(System.in); s new Scanner(System.in) StringBuilder str=new StringBuilder(s.next()
				.replaceAll("eraser","")
				.replaceAll("dream","D")
				.replaceAll("er","R")
				.replaceAll("as","A")); str new StringBuilder(s.next()
				.replaceAll("eraser","")
				.replaceAll("dream","D")
				.replaceAll("er","R")
				.replaceAll("as","A")) String[] m={"RAe","DR","D"}; m {"RAe","DR","D"} "RAe" "DR" "D" System.out.println(str.length()==0?"YES":"NO") System.out.println System.out System System.out str.length()==0?"YES":"NO" str.length()==0 str.length() str.length str 0 "YES" "NO" String[]$ $
import java.util.Scanner;

class Main{
	public static void main(String[]$){
		Scanner s=new Scanner(System.in);
		StringBuilder str=new StringBuilder(s.next()
				.replaceAll("eraser","")
				.replaceAll("dream","D")
				.replaceAll("er","R")
				.replaceAll("as","A"));
		String[] m={"RAe","DR","D"};
		loop:
		while(true){
			for(String b:m){
				if(str.toString().endsWith(b)){
					str.delete(str.length()-b.length(),str.length());
					continue loop;
				}
			}
			break;
		}
		System.out.println(str.length()==0?"YES":"NO");
	}
}