import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	static final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

	public static void main(String[] args) throws IOException {

		// --- input ---
		String s = in.readLine();
		in.close();

		// --- resolv ---
		int to = s.length();
		String[] words = {"dream", "erase", "eraser", "dreamer"}; // 5,6,7
		label : while(to > 0) {
			for(String w : words) {
				if(to >= w.length() && w.equals(s.substring(to - w.length(), to))) {
					to -= w.length();
					continue label;
				}
			}
			System.out.println("NO");
			return;
		}

		System.out.println((to==0)?"YES":"NO");
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	static final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

	public static void main(String[] args) throws IOException {

		// --- input ---
		String s = in.readLine();
		in.close();

		// --- resolv ---
		int to = s.length();
		String[] words = {"dream", "erase", "eraser", "dreamer"}; // 5,6,7
		label : while(to > 0) {
			for(String w : words) {
				if(to >= w.length() && w.equals(s.substring(to - w.length(), to))) {
					to -= w.length();
					continue label;
				}
			}
			System.out.println("NO");
			return;
		}

		System.out.println((to==0)?"YES":"NO");
	}
} Main static final BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) public static void main(String[] args) throws IOException {

		// --- input ---
		String s = in.readLine();
		in.close();

		// --- resolv ---
		int to = s.length();
		String[] words = {"dream", "erase", "eraser", "dreamer"}; // 5,6,7
		label : while(to > 0) {
			for(String w : words) {
				if(to >= w.length() && w.equals(s.substring(to - w.length(), to))) {
					to -= w.length();
					continue label;
				}
			}
			System.out.println("NO");
			return;
		}

		System.out.println((to==0)?"YES":"NO");
	} main {

		// --- input ---
		String s = in.readLine();
		in.close();

		// --- resolv ---
		int to = s.length();
		String[] words = {"dream", "erase", "eraser", "dreamer"}; // 5,6,7
		label : while(to > 0) {
			for(String w : words) {
				if(to >= w.length() && w.equals(s.substring(to - w.length(), to))) {
					to -= w.length();
					continue label;
				}
			}
			System.out.println("NO");
			return;
		}

		System.out.println((to==0)?"YES":"NO");
	} String s = in.readLine(); s in.readLine() in.readLine in in.close() in.close in int to = s.length(); to s.length() s.length s String[] words = {"dream", "erase", "eraser", "dreamer"}; words {"dream", "erase", "eraser", "dreamer"} "dream" "erase" "eraser" "dreamer" System.out.println((to==0)?"YES":"NO") System.out.println System.out System System.out (to==0)?"YES":"NO" (to==0) to 0 "YES" "NO" String[] args args public class Main {

	static final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

	public static void main(String[] args) throws IOException {

		// --- input ---
		String s = in.readLine();
		in.close();

		// --- resolv ---
		int to = s.length();
		String[] words = {"dream", "erase", "eraser", "dreamer"}; // 5,6,7
		label : while(to > 0) {
			for(String w : words) {
				if(to >= w.length() && w.equals(s.substring(to - w.length(), to))) {
					to -= w.length();
					continue label;
				}
			}
			System.out.println("NO");
			return;
		}

		System.out.println((to==0)?"YES":"NO");
	}
} public class Main {

	static final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

	public static void main(String[] args) throws IOException {

		// --- input ---
		String s = in.readLine();
		in.close();

		// --- resolv ---
		int to = s.length();
		String[] words = {"dream", "erase", "eraser", "dreamer"}; // 5,6,7
		label : while(to > 0) {
			for(String w : words) {
				if(to >= w.length() && w.equals(s.substring(to - w.length(), to))) {
					to -= w.length();
					continue label;
				}
			}
			System.out.println("NO");
			return;
		}

		System.out.println((to==0)?"YES":"NO");
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	static final BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

	public static void main(String[] args) throws IOException {

		// --- input ---
		String s = in.readLine();
		in.close();

		// --- resolv ---
		int to = s.length();
		String[] words = {"dream", "erase", "eraser", "dreamer"}; // 5,6,7
		label : while(to > 0) {
			for(String w : words) {
				if(to >= w.length() && w.equals(s.substring(to - w.length(), to))) {
					to -= w.length();
					continue label;
				}
			}
			System.out.println("NO");
			return;
		}

		System.out.println((to==0)?"YES":"NO");
	}
}
