import java.util.*;
import java.lang.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String ss = sc.next();
		StringBuilder s = new StringBuilder(ss);
		boolean bre = false;
		while (s.length() > 0) {
			if (s.substring(s.length() - 5).equals("dream") || s.substring(s.length() - 5).equals("erase")) {
				s.delete(s.length() - 5, s.length());
			} else if (s.substring(s.length() - 6).equals("eraser")) {
				s.delete(s.length() - 6, s.length());;
			} else if (s.substring(s.length() - 7).equals("dreamer")) {
				s.delete(s.length() - 7, s.length());
			} else {
				bre = true;
				break;
			}
		}
		if (bre) {
			System.out.println("NO");
		} else {
			System.out.println("YES");
		}
	}
} import java.util.*; util.* java import java.lang.*; lang.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String ss = sc.next();
		StringBuilder s = new StringBuilder(ss);
		boolean bre = false;
		while (s.length() > 0) {
			if (s.substring(s.length() - 5).equals("dream") || s.substring(s.length() - 5).equals("erase")) {
				s.delete(s.length() - 5, s.length());
			} else if (s.substring(s.length() - 6).equals("eraser")) {
				s.delete(s.length() - 6, s.length());;
			} else if (s.substring(s.length() - 7).equals("dreamer")) {
				s.delete(s.length() - 7, s.length());
			} else {
				bre = true;
				break;
			}
		}
		if (bre) {
			System.out.println("NO");
		} else {
			System.out.println("YES");
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String ss = sc.next();
		StringBuilder s = new StringBuilder(ss);
		boolean bre = false;
		while (s.length() > 0) {
			if (s.substring(s.length() - 5).equals("dream") || s.substring(s.length() - 5).equals("erase")) {
				s.delete(s.length() - 5, s.length());
			} else if (s.substring(s.length() - 6).equals("eraser")) {
				s.delete(s.length() - 6, s.length());;
			} else if (s.substring(s.length() - 7).equals("dreamer")) {
				s.delete(s.length() - 7, s.length());
			} else {
				bre = true;
				break;
			}
		}
		if (bre) {
			System.out.println("NO");
		} else {
			System.out.println("YES");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String ss = sc.next();
		StringBuilder s = new StringBuilder(ss);
		boolean bre = false;
		while (s.length() > 0) {
			if (s.substring(s.length() - 5).equals("dream") || s.substring(s.length() - 5).equals("erase")) {
				s.delete(s.length() - 5, s.length());
			} else if (s.substring(s.length() - 6).equals("eraser")) {
				s.delete(s.length() - 6, s.length());;
			} else if (s.substring(s.length() - 7).equals("dreamer")) {
				s.delete(s.length() - 7, s.length());
			} else {
				bre = true;
				break;
			}
		}
		if (bre) {
			System.out.println("NO");
		} else {
			System.out.println("YES");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String ss = sc.next(); ss sc.next() sc.next sc StringBuilder s = new StringBuilder(ss); s new StringBuilder(ss) boolean bre = false; bre false while (s.length() > 0) {
			if (s.substring(s.length() - 5).equals("dream") || s.substring(s.length() - 5).equals("erase")) {
				s.delete(s.length() - 5, s.length());
			} else if (s.substring(s.length() - 6).equals("eraser")) {
				s.delete(s.length() - 6, s.length());;
			} else if (s.substring(s.length() - 7).equals("dreamer")) {
				s.delete(s.length() - 7, s.length());
			} else {
				bre = true;
				break;
			}
		} s.length() > 0 s.length() s.length s 0 {
			if (s.substring(s.length() - 5).equals("dream") || s.substring(s.length() - 5).equals("erase")) {
				s.delete(s.length() - 5, s.length());
			} else if (s.substring(s.length() - 6).equals("eraser")) {
				s.delete(s.length() - 6, s.length());;
			} else if (s.substring(s.length() - 7).equals("dreamer")) {
				s.delete(s.length() - 7, s.length());
			} else {
				bre = true;
				break;
			}
		} if (s.substring(s.length() - 5).equals("dream") || s.substring(s.length() - 5).equals("erase")) {
				s.delete(s.length() - 5, s.length());
			} else if (s.substring(s.length() - 6).equals("eraser")) {
				s.delete(s.length() - 6, s.length());;
			} else if (s.substring(s.length() - 7).equals("dreamer")) {
				s.delete(s.length() - 7, s.length());
			} else {
				bre = true;
				break;
			} s.substring(s.length() - 5).equals("dream") || s.substring(s.length() - 5).equals("erase") s.substring(s.length() - 5).equals("dream") s.substring(s.length() - 5).equals s.substring(s.length() - 5) s.substring s s.length() - 5 s.length() s.length s 5 "dream" s.substring(s.length() - 5).equals("erase") s.substring(s.length() - 5).equals s.substring(s.length() - 5) s.substring s s.length() - 5 s.length() s.length s 5 "erase" {
				s.delete(s.length() - 5, s.length());
			} s.delete(s.length() - 5, s.length()) s.delete s s.length() - 5 s.length() s.length s 5 s.length() s.length s if (s.substring(s.length() - 6).equals("eraser")) {
				s.delete(s.length() - 6, s.length());;
			} else if (s.substring(s.length() - 7).equals("dreamer")) {
				s.delete(s.length() - 7, s.length());
			} else {
				bre = true;
				break;
			} s.substring(s.length() - 6).equals("eraser") s.substring(s.length() - 6).equals s.substring(s.length() - 6) s.substring s s.length() - 6 s.length() s.length s 6 "eraser" {
				s.delete(s.length() - 6, s.length());;
			} s.delete(s.length() - 6, s.length()) s.delete s s.length() - 6 s.length() s.length s 6 s.length() s.length s if (s.substring(s.length() - 7).equals("dreamer")) {
				s.delete(s.length() - 7, s.length());
			} else {
				bre = true;
				break;
			} s.substring(s.length() - 7).equals("dreamer") s.substring(s.length() - 7).equals s.substring(s.length() - 7) s.substring s s.length() - 7 s.length() s.length s 7 "dreamer" {
				s.delete(s.length() - 7, s.length());
			} s.delete(s.length() - 7, s.length()) s.delete s s.length() - 7 s.length() s.length s 7 s.length() s.length s {
				bre = true;
				break;
			} bre = true bre true break; if (bre) {
			System.out.println("NO");
		} else {
			System.out.println("YES");
		} bre {
			System.out.println("NO");
		} System.out.println("NO") System.out.println System.out System System.out "NO" {
			System.out.println("YES");
		} System.out.println("YES") System.out.println System.out System System.out "YES" String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String ss = sc.next();
		StringBuilder s = new StringBuilder(ss);
		boolean bre = false;
		while (s.length() > 0) {
			if (s.substring(s.length() - 5).equals("dream") || s.substring(s.length() - 5).equals("erase")) {
				s.delete(s.length() - 5, s.length());
			} else if (s.substring(s.length() - 6).equals("eraser")) {
				s.delete(s.length() - 6, s.length());;
			} else if (s.substring(s.length() - 7).equals("dreamer")) {
				s.delete(s.length() - 7, s.length());
			} else {
				bre = true;
				break;
			}
		}
		if (bre) {
			System.out.println("NO");
		} else {
			System.out.println("YES");
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String ss = sc.next();
		StringBuilder s = new StringBuilder(ss);
		boolean bre = false;
		while (s.length() > 0) {
			if (s.substring(s.length() - 5).equals("dream") || s.substring(s.length() - 5).equals("erase")) {
				s.delete(s.length() - 5, s.length());
			} else if (s.substring(s.length() - 6).equals("eraser")) {
				s.delete(s.length() - 6, s.length());;
			} else if (s.substring(s.length() - 7).equals("dreamer")) {
				s.delete(s.length() - 7, s.length());
			} else {
				bre = true;
				break;
			}
		}
		if (bre) {
			System.out.println("NO");
		} else {
			System.out.println("YES");
		}
	}
} Main
import java.util.*;
import java.lang.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String ss = sc.next();
		StringBuilder s = new StringBuilder(ss);
		boolean bre = false;
		while (s.length() > 0) {
			if (s.substring(s.length() - 5).equals("dream") || s.substring(s.length() - 5).equals("erase")) {
				s.delete(s.length() - 5, s.length());
			} else if (s.substring(s.length() - 6).equals("eraser")) {
				s.delete(s.length() - 6, s.length());;
			} else if (s.substring(s.length() - 7).equals("dreamer")) {
				s.delete(s.length() - 7, s.length());
			} else {
				bre = true;
				break;
			}
		}
		if (bre) {
			System.out.println("NO");
		} else {
			System.out.println("YES");
		}
	}
}