import java.util.ArrayDeque;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	String S;
	StringBuilder T = new StringBuilder();
	String P[] = {"dream", "dreamer", "erase", "eraser"};

	public void run() {
		Scanner sc = new Scanner(System.in);
		S = sc.next();

		ArrayDeque<Integer> stack = new ArrayDeque<Integer>();
		stack.push(0);
		boolean ans = false;
		while(!stack.isEmpty()) {
			int i = stack.pop();
			if(i == S.length()) {
				ans = true;
				break;
			}
			for(int j=0; j<4; j++) {
				if(i+P[j].length() <= S.length() && P[j].equals(S.substring(i, i+P[j].length()))) {
					stack.push(i+P[j].length());
				}
			}
		}

		if(ans) System.out.println("YES");
		else System.out.println("NO");

		sc.close();
	}
} import java.util.ArrayDeque; ArrayDeque java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	String S;
	StringBuilder T = new StringBuilder();
	String P[] = {"dream", "dreamer", "erase", "eraser"};

	public void run() {
		Scanner sc = new Scanner(System.in);
		S = sc.next();

		ArrayDeque<Integer> stack = new ArrayDeque<Integer>();
		stack.push(0);
		boolean ans = false;
		while(!stack.isEmpty()) {
			int i = stack.pop();
			if(i == S.length()) {
				ans = true;
				break;
			}
			for(int j=0; j<4; j++) {
				if(i+P[j].length() <= S.length() && P[j].equals(S.substring(i, i+P[j].length()))) {
					stack.push(i+P[j].length());
				}
			}
		}

		if(ans) System.out.println("YES");
		else System.out.println("NO");

		sc.close();
	}
} Main String S; S StringBuilder T = new StringBuilder(); T new StringBuilder() String P[] = {"dream", "dreamer", "erase", "eraser"}; P {"dream", "dreamer", "erase", "eraser"} "dream" "dreamer" "erase" "eraser" public static void main(String[] args) {
		Main main = new Main();
		main.run();
	} main {
		Main main = new Main();
		main.run();
	} Main main = new Main(); main new Main() main.run() main.run main String[] args args public void run() {
		Scanner sc = new Scanner(System.in);
		S = sc.next();

		ArrayDeque<Integer> stack = new ArrayDeque<Integer>();
		stack.push(0);
		boolean ans = false;
		while(!stack.isEmpty()) {
			int i = stack.pop();
			if(i == S.length()) {
				ans = true;
				break;
			}
			for(int j=0; j<4; j++) {
				if(i+P[j].length() <= S.length() && P[j].equals(S.substring(i, i+P[j].length()))) {
					stack.push(i+P[j].length());
				}
			}
		}

		if(ans) System.out.println("YES");
		else System.out.println("NO");

		sc.close();
	} run {
		Scanner sc = new Scanner(System.in);
		S = sc.next();

		ArrayDeque<Integer> stack = new ArrayDeque<Integer>();
		stack.push(0);
		boolean ans = false;
		while(!stack.isEmpty()) {
			int i = stack.pop();
			if(i == S.length()) {
				ans = true;
				break;
			}
			for(int j=0; j<4; j++) {
				if(i+P[j].length() <= S.length() && P[j].equals(S.substring(i, i+P[j].length()))) {
					stack.push(i+P[j].length());
				}
			}
		}

		if(ans) System.out.println("YES");
		else System.out.println("NO");

		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) S = sc.next() S sc.next() sc.next sc ArrayDeque<Integer> stack = new ArrayDeque<Integer>(); stack new ArrayDeque<Integer>() stack.push(0) stack.push stack 0 boolean ans = false; ans false while(!stack.isEmpty()) {
			int i = stack.pop();
			if(i == S.length()) {
				ans = true;
				break;
			}
			for(int j=0; j<4; j++) {
				if(i+P[j].length() <= S.length() && P[j].equals(S.substring(i, i+P[j].length()))) {
					stack.push(i+P[j].length());
				}
			}
		} !stack.isEmpty() stack.isEmpty() stack.isEmpty stack {
			int i = stack.pop();
			if(i == S.length()) {
				ans = true;
				break;
			}
			for(int j=0; j<4; j++) {
				if(i+P[j].length() <= S.length() && P[j].equals(S.substring(i, i+P[j].length()))) {
					stack.push(i+P[j].length());
				}
			}
		} int i = stack.pop(); i stack.pop() stack.pop stack if(i == S.length()) {
				ans = true;
				break;
			} i == S.length() i S.length() S.length S {
				ans = true;
				break;
			} ans = true ans true break; for(int j=0; j<4; j++) {
				if(i+P[j].length() <= S.length() && P[j].equals(S.substring(i, i+P[j].length()))) {
					stack.push(i+P[j].length());
				}
			} int j=0; int j=0; j 0 j<4 j 4 j++ j++ j {
				if(i+P[j].length() <= S.length() && P[j].equals(S.substring(i, i+P[j].length()))) {
					stack.push(i+P[j].length());
				}
			} {
				if(i+P[j].length() <= S.length() && P[j].equals(S.substring(i, i+P[j].length()))) {
					stack.push(i+P[j].length());
				}
			} if(i+P[j].length() <= S.length() && P[j].equals(S.substring(i, i+P[j].length()))) {
					stack.push(i+P[j].length());
				} i+P[j].length() <= S.length() && P[j].equals(S.substring(i, i+P[j].length())) i+P[j].length() <= S.length() i+P[j].length() i P[j].length() P[j].length P[j] P j S.length() S.length S P[j].equals(S.substring(i, i+P[j].length())) P[j].equals P[j] P j S.substring(i, i+P[j].length()) S.substring S i i+P[j].length() i P[j].length() P[j].length P[j] P j {
					stack.push(i+P[j].length());
				} stack.push(i+P[j].length()) stack.push stack i+P[j].length() i P[j].length() P[j].length P[j] P j if(ans) System.out.println("YES");
		else System.out.println("NO"); ans 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" sc.close() sc.close sc public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	String S;
	StringBuilder T = new StringBuilder();
	String P[] = {"dream", "dreamer", "erase", "eraser"};

	public void run() {
		Scanner sc = new Scanner(System.in);
		S = sc.next();

		ArrayDeque<Integer> stack = new ArrayDeque<Integer>();
		stack.push(0);
		boolean ans = false;
		while(!stack.isEmpty()) {
			int i = stack.pop();
			if(i == S.length()) {
				ans = true;
				break;
			}
			for(int j=0; j<4; j++) {
				if(i+P[j].length() <= S.length() && P[j].equals(S.substring(i, i+P[j].length()))) {
					stack.push(i+P[j].length());
				}
			}
		}

		if(ans) System.out.println("YES");
		else System.out.println("NO");

		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	String S;
	StringBuilder T = new StringBuilder();
	String P[] = {"dream", "dreamer", "erase", "eraser"};

	public void run() {
		Scanner sc = new Scanner(System.in);
		S = sc.next();

		ArrayDeque<Integer> stack = new ArrayDeque<Integer>();
		stack.push(0);
		boolean ans = false;
		while(!stack.isEmpty()) {
			int i = stack.pop();
			if(i == S.length()) {
				ans = true;
				break;
			}
			for(int j=0; j<4; j++) {
				if(i+P[j].length() <= S.length() && P[j].equals(S.substring(i, i+P[j].length()))) {
					stack.push(i+P[j].length());
				}
			}
		}

		if(ans) System.out.println("YES");
		else System.out.println("NO");

		sc.close();
	}
} Main
import java.util.ArrayDeque;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	String S;
	StringBuilder T = new StringBuilder();
	String P[] = {"dream", "dreamer", "erase", "eraser"};

	public void run() {
		Scanner sc = new Scanner(System.in);
		S = sc.next();

		ArrayDeque<Integer> stack = new ArrayDeque<Integer>();
		stack.push(0);
		boolean ans = false;
		while(!stack.isEmpty()) {
			int i = stack.pop();
			if(i == S.length()) {
				ans = true;
				break;
			}
			for(int j=0; j<4; j++) {
				if(i+P[j].length() <= S.length() && P[j].equals(S.substring(i, i+P[j].length()))) {
					stack.push(i+P[j].length());
				}
			}
		}

		if(ans) System.out.println("YES");
		else System.out.println("NO");

		sc.close();
	}
}