import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String str = sc.next();
			int len = str.length();
			while (len > 0) {
				String five = str.substring(len - 5, len);
				if (five.equals("erase") || five.equals("dream")) {
					len -= 5;
					continue;
				} else {
					String six = str.substring(len - 6, len);
					if (six.equals("eraser")) {
						len -= 6;
						continue;
					} else {
						String seven = str.substring(len - 7, len);
						if (seven.equals("dreamer")) {
							len -= 7;
							continue;
						}
					}
				}
				break;
			}
			if (len == 0) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String str = sc.next();
			int len = str.length();
			while (len > 0) {
				String five = str.substring(len - 5, len);
				if (five.equals("erase") || five.equals("dream")) {
					len -= 5;
					continue;
				} else {
					String six = str.substring(len - 6, len);
					if (six.equals("eraser")) {
						len -= 6;
						continue;
					} else {
						String seven = str.substring(len - 7, len);
						if (seven.equals("dreamer")) {
							len -= 7;
							continue;
						}
					}
				}
				break;
			}
			if (len == 0) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}
} Main public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String str = sc.next();
			int len = str.length();
			while (len > 0) {
				String five = str.substring(len - 5, len);
				if (five.equals("erase") || five.equals("dream")) {
					len -= 5;
					continue;
				} else {
					String six = str.substring(len - 6, len);
					if (six.equals("eraser")) {
						len -= 6;
						continue;
					} else {
						String seven = str.substring(len - 7, len);
						if (seven.equals("dreamer")) {
							len -= 7;
							continue;
						}
					}
				}
				break;
			}
			if (len == 0) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	} main {
		try (Scanner sc = new Scanner(System.in)) {
			String str = sc.next();
			int len = str.length();
			while (len > 0) {
				String five = str.substring(len - 5, len);
				if (five.equals("erase") || five.equals("dream")) {
					len -= 5;
					continue;
				} else {
					String six = str.substring(len - 6, len);
					if (six.equals("eraser")) {
						len -= 6;
						continue;
					} else {
						String seven = str.substring(len - 7, len);
						if (seven.equals("dreamer")) {
							len -= 7;
							continue;
						}
					}
				}
				break;
			}
			if (len == 0) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	} try (Scanner sc = new Scanner(System.in)) {
			String str = sc.next();
			int len = str.length();
			while (len > 0) {
				String five = str.substring(len - 5, len);
				if (five.equals("erase") || five.equals("dream")) {
					len -= 5;
					continue;
				} else {
					String six = str.substring(len - 6, len);
					if (six.equals("eraser")) {
						len -= 6;
						continue;
					} else {
						String seven = str.substring(len - 7, len);
						if (seven.equals("dreamer")) {
							len -= 7;
							continue;
						}
					}
				}
				break;
			}
			if (len == 0) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		} {
			String str = sc.next();
			int len = str.length();
			while (len > 0) {
				String five = str.substring(len - 5, len);
				if (five.equals("erase") || five.equals("dream")) {
					len -= 5;
					continue;
				} else {
					String six = str.substring(len - 6, len);
					if (six.equals("eraser")) {
						len -= 6;
						continue;
					} else {
						String seven = str.substring(len - 7, len);
						if (seven.equals("dreamer")) {
							len -= 7;
							continue;
						}
					}
				}
				break;
			}
			if (len == 0) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		} Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc int len = str.length(); len str.length() str.length str while (len > 0) {
				String five = str.substring(len - 5, len);
				if (five.equals("erase") || five.equals("dream")) {
					len -= 5;
					continue;
				} else {
					String six = str.substring(len - 6, len);
					if (six.equals("eraser")) {
						len -= 6;
						continue;
					} else {
						String seven = str.substring(len - 7, len);
						if (seven.equals("dreamer")) {
							len -= 7;
							continue;
						}
					}
				}
				break;
			} len > 0 len 0 {
				String five = str.substring(len - 5, len);
				if (five.equals("erase") || five.equals("dream")) {
					len -= 5;
					continue;
				} else {
					String six = str.substring(len - 6, len);
					if (six.equals("eraser")) {
						len -= 6;
						continue;
					} else {
						String seven = str.substring(len - 7, len);
						if (seven.equals("dreamer")) {
							len -= 7;
							continue;
						}
					}
				}
				break;
			} String five = str.substring(len - 5, len); five str.substring(len - 5, len) str.substring str len - 5 len 5 len if (five.equals("erase") || five.equals("dream")) {
					len -= 5;
					continue;
				} else {
					String six = str.substring(len - 6, len);
					if (six.equals("eraser")) {
						len -= 6;
						continue;
					} else {
						String seven = str.substring(len - 7, len);
						if (seven.equals("dreamer")) {
							len -= 7;
							continue;
						}
					}
				} five.equals("erase") || five.equals("dream") five.equals("erase") five.equals five "erase" five.equals("dream") five.equals five "dream" {
					len -= 5;
					continue;
				} len -= 5 len 5 continue; {
					String six = str.substring(len - 6, len);
					if (six.equals("eraser")) {
						len -= 6;
						continue;
					} else {
						String seven = str.substring(len - 7, len);
						if (seven.equals("dreamer")) {
							len -= 7;
							continue;
						}
					}
				} String six = str.substring(len - 6, len); six str.substring(len - 6, len) str.substring str len - 6 len 6 len if (six.equals("eraser")) {
						len -= 6;
						continue;
					} else {
						String seven = str.substring(len - 7, len);
						if (seven.equals("dreamer")) {
							len -= 7;
							continue;
						}
					} six.equals("eraser") six.equals six "eraser" {
						len -= 6;
						continue;
					} len -= 6 len 6 continue; {
						String seven = str.substring(len - 7, len);
						if (seven.equals("dreamer")) {
							len -= 7;
							continue;
						}
					} String seven = str.substring(len - 7, len); seven str.substring(len - 7, len) str.substring str len - 7 len 7 len if (seven.equals("dreamer")) {
							len -= 7;
							continue;
						} seven.equals("dreamer") seven.equals seven "dreamer" {
							len -= 7;
							continue;
						} len -= 7 len 7 continue; break; if (len == 0) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			} len == 0 len 0 {
				System.out.println("YES");
			} System.out.println("YES") System.out.println System.out System System.out "YES" {
				System.out.println("NO");
			} System.out.println("NO") System.out.println System.out System System.out "NO" String[] args args public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String str = sc.next();
			int len = str.length();
			while (len > 0) {
				String five = str.substring(len - 5, len);
				if (five.equals("erase") || five.equals("dream")) {
					len -= 5;
					continue;
				} else {
					String six = str.substring(len - 6, len);
					if (six.equals("eraser")) {
						len -= 6;
						continue;
					} else {
						String seven = str.substring(len - 7, len);
						if (seven.equals("dreamer")) {
							len -= 7;
							continue;
						}
					}
				}
				break;
			}
			if (len == 0) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}
} public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String str = sc.next();
			int len = str.length();
			while (len > 0) {
				String five = str.substring(len - 5, len);
				if (five.equals("erase") || five.equals("dream")) {
					len -= 5;
					continue;
				} else {
					String six = str.substring(len - 6, len);
					if (six.equals("eraser")) {
						len -= 6;
						continue;
					} else {
						String seven = str.substring(len - 7, len);
						if (seven.equals("dreamer")) {
							len -= 7;
							continue;
						}
					}
				}
				break;
			}
			if (len == 0) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String str = sc.next();
			int len = str.length();
			while (len > 0) {
				String five = str.substring(len - 5, len);
				if (five.equals("erase") || five.equals("dream")) {
					len -= 5;
					continue;
				} else {
					String six = str.substring(len - 6, len);
					if (six.equals("eraser")) {
						len -= 6;
						continue;
					} else {
						String seven = str.substring(len - 7, len);
						if (seven.equals("dreamer")) {
							len -= 7;
							continue;
						}
					}
				}
				break;
			}
			if (len == 0) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}
}
