import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		List<String> l = new ArrayList<>();
		l.add("dream");
		l.add("dreamer");
		l.add("erase");
		l.add("eraser");
		

		boolean dp[] = new boolean[s.length()+1];
		dp[0] = true;
		for(int i=0;i<=s.length();i++) {			
			for(String t : l) {
				int len = t.length();
				if(i-len>=0) {
					if(dp[i-len]==false)continue;
					if(s.substring(i-len, i).equals(t)) dp[i]=true;
				}
			}
		}
		if(dp[s.length()]==true)System.out.println("YES");
		else System.out.println("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();
		List<String> l = new ArrayList<>();
		l.add("dream");
		l.add("dreamer");
		l.add("erase");
		l.add("eraser");
		

		boolean dp[] = new boolean[s.length()+1];
		dp[0] = true;
		for(int i=0;i<=s.length();i++) {			
			for(String t : l) {
				int len = t.length();
				if(i-len>=0) {
					if(dp[i-len]==false)continue;
					if(s.substring(i-len, i).equals(t)) dp[i]=true;
				}
			}
		}
		if(dp[s.length()]==true)System.out.println("YES");
		else System.out.println("NO");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		List<String> l = new ArrayList<>();
		l.add("dream");
		l.add("dreamer");
		l.add("erase");
		l.add("eraser");
		

		boolean dp[] = new boolean[s.length()+1];
		dp[0] = true;
		for(int i=0;i<=s.length();i++) {			
			for(String t : l) {
				int len = t.length();
				if(i-len>=0) {
					if(dp[i-len]==false)continue;
					if(s.substring(i-len, i).equals(t)) dp[i]=true;
				}
			}
		}
		if(dp[s.length()]==true)System.out.println("YES");
		else System.out.println("NO");
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		List<String> l = new ArrayList<>();
		l.add("dream");
		l.add("dreamer");
		l.add("erase");
		l.add("eraser");
		

		boolean dp[] = new boolean[s.length()+1];
		dp[0] = true;
		for(int i=0;i<=s.length();i++) {			
			for(String t : l) {
				int len = t.length();
				if(i-len>=0) {
					if(dp[i-len]==false)continue;
					if(s.substring(i-len, i).equals(t)) dp[i]=true;
				}
			}
		}
		if(dp[s.length()]==true)System.out.println("YES");
		else System.out.println("NO");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc List<String> l = new ArrayList<>(); l new ArrayList<>() l.add("dream") l.add l "dream" l.add("dreamer") l.add l "dreamer" l.add("erase") l.add l "erase" l.add("eraser") l.add l "eraser" boolean dp[] = new boolean[s.length()+1]; dp new boolean[s.length()+1] s.length()+1 s.length() s.length s 1 dp[0] = true dp[0] dp 0 true for(int i=0;i<=s.length();i++) {			
			for(String t : l) {
				int len = t.length();
				if(i-len>=0) {
					if(dp[i-len]==false)continue;
					if(s.substring(i-len, i).equals(t)) dp[i]=true;
				}
			}
		} int i=0; int i=0; i 0 i<=s.length() i s.length() s.length s i++ i++ i {			
			for(String t : l) {
				int len = t.length();
				if(i-len>=0) {
					if(dp[i-len]==false)continue;
					if(s.substring(i-len, i).equals(t)) dp[i]=true;
				}
			}
		} {			
			for(String t : l) {
				int len = t.length();
				if(i-len>=0) {
					if(dp[i-len]==false)continue;
					if(s.substring(i-len, i).equals(t)) dp[i]=true;
				}
			}
		} for(String t : l) {
				int len = t.length();
				if(i-len>=0) {
					if(dp[i-len]==false)continue;
					if(s.substring(i-len, i).equals(t)) dp[i]=true;
				}
			} String t l {
				int len = t.length();
				if(i-len>=0) {
					if(dp[i-len]==false)continue;
					if(s.substring(i-len, i).equals(t)) dp[i]=true;
				}
			} {
				int len = t.length();
				if(i-len>=0) {
					if(dp[i-len]==false)continue;
					if(s.substring(i-len, i).equals(t)) dp[i]=true;
				}
			} int len = t.length(); len t.length() t.length t if(i-len>=0) {
					if(dp[i-len]==false)continue;
					if(s.substring(i-len, i).equals(t)) dp[i]=true;
				} i-len>=0 i-len i len 0 {
					if(dp[i-len]==false)continue;
					if(s.substring(i-len, i).equals(t)) dp[i]=true;
				} if(dp[i-len]==false)continue; dp[i-len]==false dp[i-len] dp i-len i len false continue; if(s.substring(i-len, i).equals(t)) dp[i]=true; s.substring(i-len, i).equals(t) s.substring(i-len, i).equals s.substring(i-len, i) s.substring s i-len i len i t dp[i]=true dp[i] dp i true if(dp[s.length()]==true)System.out.println("YES");
		else System.out.println("NO"); dp[s.length()]==true dp[s.length()] dp s.length() s.length s true System.out.println("YES") System.out.println System.out System System.out "YES" System.out.println("NO") System.out.println System.out System System.out "NO" String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		List<String> l = new ArrayList<>();
		l.add("dream");
		l.add("dreamer");
		l.add("erase");
		l.add("eraser");
		

		boolean dp[] = new boolean[s.length()+1];
		dp[0] = true;
		for(int i=0;i<=s.length();i++) {			
			for(String t : l) {
				int len = t.length();
				if(i-len>=0) {
					if(dp[i-len]==false)continue;
					if(s.substring(i-len, i).equals(t)) dp[i]=true;
				}
			}
		}
		if(dp[s.length()]==true)System.out.println("YES");
		else System.out.println("NO");
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		List<String> l = new ArrayList<>();
		l.add("dream");
		l.add("dreamer");
		l.add("erase");
		l.add("eraser");
		

		boolean dp[] = new boolean[s.length()+1];
		dp[0] = true;
		for(int i=0;i<=s.length();i++) {			
			for(String t : l) {
				int len = t.length();
				if(i-len>=0) {
					if(dp[i-len]==false)continue;
					if(s.substring(i-len, i).equals(t)) dp[i]=true;
				}
			}
		}
		if(dp[s.length()]==true)System.out.println("YES");
		else System.out.println("NO");
	}
} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		List<String> l = new ArrayList<>();
		l.add("dream");
		l.add("dreamer");
		l.add("erase");
		l.add("eraser");
		

		boolean dp[] = new boolean[s.length()+1];
		dp[0] = true;
		for(int i=0;i<=s.length();i++) {			
			for(String t : l) {
				int len = t.length();
				if(i-len>=0) {
					if(dp[i-len]==false)continue;
					if(s.substring(i-len, i).equals(t)) dp[i]=true;
				}
			}
		}
		if(dp[s.length()]==true)System.out.println("YES");
		else System.out.println("NO");
	}
}

