import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		boolean isOk = false;
		String[] divide = { "dream", "dreamer", "erase", "eraser" };
		int t = S.length();
		while (true) {
			for (String s : divide) {
				if (t - s.length() >= 0 && S.substring(t - s.length(), t).equals(s)) {
					isOk = true;
					t -= s.length();
					break;
				} else {
					isOk = false;
				}
			}
			if (!isOk || t == 0) {
				break;
			}
		}
		System.out.println(isOk ? "YES" : "NO");
		in.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		boolean isOk = false;
		String[] divide = { "dream", "dreamer", "erase", "eraser" };
		int t = S.length();
		while (true) {
			for (String s : divide) {
				if (t - s.length() >= 0 && S.substring(t - s.length(), t).equals(s)) {
					isOk = true;
					t -= s.length();
					break;
				} else {
					isOk = false;
				}
			}
			if (!isOk || t == 0) {
				break;
			}
		}
		System.out.println(isOk ? "YES" : "NO");
		in.close();
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		boolean isOk = false;
		String[] divide = { "dream", "dreamer", "erase", "eraser" };
		int t = S.length();
		while (true) {
			for (String s : divide) {
				if (t - s.length() >= 0 && S.substring(t - s.length(), t).equals(s)) {
					isOk = true;
					t -= s.length();
					break;
				} else {
					isOk = false;
				}
			}
			if (!isOk || t == 0) {
				break;
			}
		}
		System.out.println(isOk ? "YES" : "NO");
		in.close();
	} main {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		boolean isOk = false;
		String[] divide = { "dream", "dreamer", "erase", "eraser" };
		int t = S.length();
		while (true) {
			for (String s : divide) {
				if (t - s.length() >= 0 && S.substring(t - s.length(), t).equals(s)) {
					isOk = true;
					t -= s.length();
					break;
				} else {
					isOk = false;
				}
			}
			if (!isOk || t == 0) {
				break;
			}
		}
		System.out.println(isOk ? "YES" : "NO");
		in.close();
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) String S = in.next(); S in.next() in.next in boolean isOk = false; isOk false String[] divide = { "dream", "dreamer", "erase", "eraser" }; divide { "dream", "dreamer", "erase", "eraser" } "dream" "dreamer" "erase" "eraser" int t = S.length(); t S.length() S.length S while (true) {
			for (String s : divide) {
				if (t - s.length() >= 0 && S.substring(t - s.length(), t).equals(s)) {
					isOk = true;
					t -= s.length();
					break;
				} else {
					isOk = false;
				}
			}
			if (!isOk || t == 0) {
				break;
			}
		} true {
			for (String s : divide) {
				if (t - s.length() >= 0 && S.substring(t - s.length(), t).equals(s)) {
					isOk = true;
					t -= s.length();
					break;
				} else {
					isOk = false;
				}
			}
			if (!isOk || t == 0) {
				break;
			}
		} for (String s : divide) {
				if (t - s.length() >= 0 && S.substring(t - s.length(), t).equals(s)) {
					isOk = true;
					t -= s.length();
					break;
				} else {
					isOk = false;
				}
			} String s divide {
				if (t - s.length() >= 0 && S.substring(t - s.length(), t).equals(s)) {
					isOk = true;
					t -= s.length();
					break;
				} else {
					isOk = false;
				}
			} {
				if (t - s.length() >= 0 && S.substring(t - s.length(), t).equals(s)) {
					isOk = true;
					t -= s.length();
					break;
				} else {
					isOk = false;
				}
			} if (t - s.length() >= 0 && S.substring(t - s.length(), t).equals(s)) {
					isOk = true;
					t -= s.length();
					break;
				} else {
					isOk = false;
				} t - s.length() >= 0 && S.substring(t - s.length(), t).equals(s) t - s.length() >= 0 t - s.length() t s.length() s.length s 0 S.substring(t - s.length(), t).equals(s) S.substring(t - s.length(), t).equals S.substring(t - s.length(), t) S.substring S t - s.length() t s.length() s.length s t s {
					isOk = true;
					t -= s.length();
					break;
				} isOk = true isOk true t -= s.length() t s.length() s.length s break; {
					isOk = false;
				} isOk = false isOk false if (!isOk || t == 0) {
				break;
			} !isOk || t == 0 !isOk isOk t == 0 t 0 {
				break;
			} break; System.out.println(isOk ? "YES" : "NO") System.out.println System.out System System.out isOk ? "YES" : "NO" isOk "YES" "NO" in.close() in.close in String[] args args public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		boolean isOk = false;
		String[] divide = { "dream", "dreamer", "erase", "eraser" };
		int t = S.length();
		while (true) {
			for (String s : divide) {
				if (t - s.length() >= 0 && S.substring(t - s.length(), t).equals(s)) {
					isOk = true;
					t -= s.length();
					break;
				} else {
					isOk = false;
				}
			}
			if (!isOk || t == 0) {
				break;
			}
		}
		System.out.println(isOk ? "YES" : "NO");
		in.close();
	}
} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		boolean isOk = false;
		String[] divide = { "dream", "dreamer", "erase", "eraser" };
		int t = S.length();
		while (true) {
			for (String s : divide) {
				if (t - s.length() >= 0 && S.substring(t - s.length(), t).equals(s)) {
					isOk = true;
					t -= s.length();
					break;
				} else {
					isOk = false;
				}
			}
			if (!isOk || t == 0) {
				break;
			}
		}
		System.out.println(isOk ? "YES" : "NO");
		in.close();
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		boolean isOk = false;
		String[] divide = { "dream", "dreamer", "erase", "eraser" };
		int t = S.length();
		while (true) {
			for (String s : divide) {
				if (t - s.length() >= 0 && S.substring(t - s.length(), t).equals(s)) {
					isOk = true;
					t -= s.length();
					break;
				} else {
					isOk = false;
				}
			}
			if (!isOk || t == 0) {
				break;
			}
		}
		System.out.println(isOk ? "YES" : "NO");
		in.close();
	}
}