import java.util.Scanner;

public class Main {
	private static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		String s = sc.next();
		int e = s.length();
		while(true) {
			if (e==0) {
				break;
			} else if (e<5) {
				System.out.println("NO");
				return;
			}

			if (s.substring(e-5, e).equals("erase")) {
				e -= 5;
			} else if (s.substring(e-5, e).equals("dream")) {
				e -= 5;
			} else if (s.substring(e-6, e).equals("eraser")) {
				e -= 6;
			} else if (s.substring(e-7, e).equals("dreamer")) {
				e -= 7;
			} else {
				System.out.println("NO");
				return;
			}
		}

		System.out.println("YES");
	}
} import java.util.Scanner; Scanner java.util public class Main {
	private static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		String s = sc.next();
		int e = s.length();
		while(true) {
			if (e==0) {
				break;
			} else if (e<5) {
				System.out.println("NO");
				return;
			}

			if (s.substring(e-5, e).equals("erase")) {
				e -= 5;
			} else if (s.substring(e-5, e).equals("dream")) {
				e -= 5;
			} else if (s.substring(e-6, e).equals("eraser")) {
				e -= 6;
			} else if (s.substring(e-7, e).equals("dreamer")) {
				e -= 7;
			} else {
				System.out.println("NO");
				return;
			}
		}

		System.out.println("YES");
	}
} Main private static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
		String s = sc.next();
		int e = s.length();
		while(true) {
			if (e==0) {
				break;
			} else if (e<5) {
				System.out.println("NO");
				return;
			}

			if (s.substring(e-5, e).equals("erase")) {
				e -= 5;
			} else if (s.substring(e-5, e).equals("dream")) {
				e -= 5;
			} else if (s.substring(e-6, e).equals("eraser")) {
				e -= 6;
			} else if (s.substring(e-7, e).equals("dreamer")) {
				e -= 7;
			} else {
				System.out.println("NO");
				return;
			}
		}

		System.out.println("YES");
	} main {
		String s = sc.next();
		int e = s.length();
		while(true) {
			if (e==0) {
				break;
			} else if (e<5) {
				System.out.println("NO");
				return;
			}

			if (s.substring(e-5, e).equals("erase")) {
				e -= 5;
			} else if (s.substring(e-5, e).equals("dream")) {
				e -= 5;
			} else if (s.substring(e-6, e).equals("eraser")) {
				e -= 6;
			} else if (s.substring(e-7, e).equals("dreamer")) {
				e -= 7;
			} else {
				System.out.println("NO");
				return;
			}
		}

		System.out.println("YES");
	} String s = sc.next(); s sc.next() sc.next sc int e = s.length(); e s.length() s.length s while(true) {
			if (e==0) {
				break;
			} else if (e<5) {
				System.out.println("NO");
				return;
			}

			if (s.substring(e-5, e).equals("erase")) {
				e -= 5;
			} else if (s.substring(e-5, e).equals("dream")) {
				e -= 5;
			} else if (s.substring(e-6, e).equals("eraser")) {
				e -= 6;
			} else if (s.substring(e-7, e).equals("dreamer")) {
				e -= 7;
			} else {
				System.out.println("NO");
				return;
			}
		} true {
			if (e==0) {
				break;
			} else if (e<5) {
				System.out.println("NO");
				return;
			}

			if (s.substring(e-5, e).equals("erase")) {
				e -= 5;
			} else if (s.substring(e-5, e).equals("dream")) {
				e -= 5;
			} else if (s.substring(e-6, e).equals("eraser")) {
				e -= 6;
			} else if (s.substring(e-7, e).equals("dreamer")) {
				e -= 7;
			} else {
				System.out.println("NO");
				return;
			}
		} if (e==0) {
				break;
			} else if (e<5) {
				System.out.println("NO");
				return;
			} e==0 e 0 {
				break;
			} break; if (e<5) {
				System.out.println("NO");
				return;
			} e<5 e 5 {
				System.out.println("NO");
				return;
			} System.out.println("NO") System.out.println System.out System System.out "NO" return; if (s.substring(e-5, e).equals("erase")) {
				e -= 5;
			} else if (s.substring(e-5, e).equals("dream")) {
				e -= 5;
			} else if (s.substring(e-6, e).equals("eraser")) {
				e -= 6;
			} else if (s.substring(e-7, e).equals("dreamer")) {
				e -= 7;
			} else {
				System.out.println("NO");
				return;
			} s.substring(e-5, e).equals("erase") s.substring(e-5, e).equals s.substring(e-5, e) s.substring s e-5 e 5 e "erase" {
				e -= 5;
			} e -= 5 e 5 if (s.substring(e-5, e).equals("dream")) {
				e -= 5;
			} else if (s.substring(e-6, e).equals("eraser")) {
				e -= 6;
			} else if (s.substring(e-7, e).equals("dreamer")) {
				e -= 7;
			} else {
				System.out.println("NO");
				return;
			} s.substring(e-5, e).equals("dream") s.substring(e-5, e).equals s.substring(e-5, e) s.substring s e-5 e 5 e "dream" {
				e -= 5;
			} e -= 5 e 5 if (s.substring(e-6, e).equals("eraser")) {
				e -= 6;
			} else if (s.substring(e-7, e).equals("dreamer")) {
				e -= 7;
			} else {
				System.out.println("NO");
				return;
			} s.substring(e-6, e).equals("eraser") s.substring(e-6, e).equals s.substring(e-6, e) s.substring s e-6 e 6 e "eraser" {
				e -= 6;
			} e -= 6 e 6 if (s.substring(e-7, e).equals("dreamer")) {
				e -= 7;
			} else {
				System.out.println("NO");
				return;
			} s.substring(e-7, e).equals("dreamer") s.substring(e-7, e).equals s.substring(e-7, e) s.substring s e-7 e 7 e "dreamer" {
				e -= 7;
			} e -= 7 e 7 {
				System.out.println("NO");
				return;
			} System.out.println("NO") System.out.println System.out System System.out "NO" return; System.out.println("YES") System.out.println System.out System System.out "YES" String[] args args public class Main {
	private static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		String s = sc.next();
		int e = s.length();
		while(true) {
			if (e==0) {
				break;
			} else if (e<5) {
				System.out.println("NO");
				return;
			}

			if (s.substring(e-5, e).equals("erase")) {
				e -= 5;
			} else if (s.substring(e-5, e).equals("dream")) {
				e -= 5;
			} else if (s.substring(e-6, e).equals("eraser")) {
				e -= 6;
			} else if (s.substring(e-7, e).equals("dreamer")) {
				e -= 7;
			} else {
				System.out.println("NO");
				return;
			}
		}

		System.out.println("YES");
	}
} public class Main {
	private static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		String s = sc.next();
		int e = s.length();
		while(true) {
			if (e==0) {
				break;
			} else if (e<5) {
				System.out.println("NO");
				return;
			}

			if (s.substring(e-5, e).equals("erase")) {
				e -= 5;
			} else if (s.substring(e-5, e).equals("dream")) {
				e -= 5;
			} else if (s.substring(e-6, e).equals("eraser")) {
				e -= 6;
			} else if (s.substring(e-7, e).equals("dreamer")) {
				e -= 7;
			} else {
				System.out.println("NO");
				return;
			}
		}

		System.out.println("YES");
	}
} Main
import java.util.Scanner;

public class Main {
	private static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		String s = sc.next();
		int e = s.length();
		while(true) {
			if (e==0) {
				break;
			} else if (e<5) {
				System.out.println("NO");
				return;
			}

			if (s.substring(e-5, e).equals("erase")) {
				e -= 5;
			} else if (s.substring(e-5, e).equals("dream")) {
				e -= 5;
			} else if (s.substring(e-6, e).equals("eraser")) {
				e -= 6;
			} else if (s.substring(e-7, e).equals("dreamer")) {
				e -= 7;
			} else {
				System.out.println("NO");
				return;
			}
		}

		System.out.println("YES");
	}
}
