import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.nextLine();
		int cnt = 0;
		
		boolean kai = true;
		
		while (S.length() > 0) {
			
			if (S.endsWith("dream")) {
				S =  new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("dreamer")) {
				S = new String(S.substring(0,S.length() - 7));
			} else if (S.endsWith("erase")) {
				S = new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("eraser")) {
				S = new String(S.substring(0,S.length() - 6));
			} else {
				kai = false;
				break;
			}
			
			if (cnt % 1000 == 0) {
				System.gc();
			}
			
			cnt++;
			
		}
		
		System.gc();
		
		if (kai == true) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		 
		 scan.close();

	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.nextLine();
		int cnt = 0;
		
		boolean kai = true;
		
		while (S.length() > 0) {
			
			if (S.endsWith("dream")) {
				S =  new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("dreamer")) {
				S = new String(S.substring(0,S.length() - 7));
			} else if (S.endsWith("erase")) {
				S = new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("eraser")) {
				S = new String(S.substring(0,S.length() - 6));
			} else {
				kai = false;
				break;
			}
			
			if (cnt % 1000 == 0) {
				System.gc();
			}
			
			cnt++;
			
		}
		
		System.gc();
		
		if (kai == true) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		 
		 scan.close();

	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.nextLine();
		int cnt = 0;
		
		boolean kai = true;
		
		while (S.length() > 0) {
			
			if (S.endsWith("dream")) {
				S =  new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("dreamer")) {
				S = new String(S.substring(0,S.length() - 7));
			} else if (S.endsWith("erase")) {
				S = new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("eraser")) {
				S = new String(S.substring(0,S.length() - 6));
			} else {
				kai = false;
				break;
			}
			
			if (cnt % 1000 == 0) {
				System.gc();
			}
			
			cnt++;
			
		}
		
		System.gc();
		
		if (kai == true) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		 
		 scan.close();

	} main {
		Scanner scan = new Scanner(System.in);
		String S = scan.nextLine();
		int cnt = 0;
		
		boolean kai = true;
		
		while (S.length() > 0) {
			
			if (S.endsWith("dream")) {
				S =  new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("dreamer")) {
				S = new String(S.substring(0,S.length() - 7));
			} else if (S.endsWith("erase")) {
				S = new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("eraser")) {
				S = new String(S.substring(0,S.length() - 6));
			} else {
				kai = false;
				break;
			}
			
			if (cnt % 1000 == 0) {
				System.gc();
			}
			
			cnt++;
			
		}
		
		System.gc();
		
		if (kai == true) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		 
		 scan.close();

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String S = scan.nextLine(); S scan.nextLine() scan.nextLine scan int cnt = 0; cnt 0 boolean kai = true; kai true while (S.length() > 0) {
			
			if (S.endsWith("dream")) {
				S =  new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("dreamer")) {
				S = new String(S.substring(0,S.length() - 7));
			} else if (S.endsWith("erase")) {
				S = new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("eraser")) {
				S = new String(S.substring(0,S.length() - 6));
			} else {
				kai = false;
				break;
			}
			
			if (cnt % 1000 == 0) {
				System.gc();
			}
			
			cnt++;
			
		} S.length() > 0 S.length() S.length S 0 {
			
			if (S.endsWith("dream")) {
				S =  new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("dreamer")) {
				S = new String(S.substring(0,S.length() - 7));
			} else if (S.endsWith("erase")) {
				S = new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("eraser")) {
				S = new String(S.substring(0,S.length() - 6));
			} else {
				kai = false;
				break;
			}
			
			if (cnt % 1000 == 0) {
				System.gc();
			}
			
			cnt++;
			
		} if (S.endsWith("dream")) {
				S =  new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("dreamer")) {
				S = new String(S.substring(0,S.length() - 7));
			} else if (S.endsWith("erase")) {
				S = new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("eraser")) {
				S = new String(S.substring(0,S.length() - 6));
			} else {
				kai = false;
				break;
			} S.endsWith("dream") S.endsWith S "dream" {
				S =  new String(S.substring(0,S.length() - 5));
			} S =  new String(S.substring(0,S.length() - 5)) S new String(S.substring(0,S.length() - 5)) if (S.endsWith("dreamer")) {
				S = new String(S.substring(0,S.length() - 7));
			} else if (S.endsWith("erase")) {
				S = new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("eraser")) {
				S = new String(S.substring(0,S.length() - 6));
			} else {
				kai = false;
				break;
			} S.endsWith("dreamer") S.endsWith S "dreamer" {
				S = new String(S.substring(0,S.length() - 7));
			} S = new String(S.substring(0,S.length() - 7)) S new String(S.substring(0,S.length() - 7)) if (S.endsWith("erase")) {
				S = new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("eraser")) {
				S = new String(S.substring(0,S.length() - 6));
			} else {
				kai = false;
				break;
			} S.endsWith("erase") S.endsWith S "erase" {
				S = new String(S.substring(0,S.length() - 5));
			} S = new String(S.substring(0,S.length() - 5)) S new String(S.substring(0,S.length() - 5)) if (S.endsWith("eraser")) {
				S = new String(S.substring(0,S.length() - 6));
			} else {
				kai = false;
				break;
			} S.endsWith("eraser") S.endsWith S "eraser" {
				S = new String(S.substring(0,S.length() - 6));
			} S = new String(S.substring(0,S.length() - 6)) S new String(S.substring(0,S.length() - 6)) {
				kai = false;
				break;
			} kai = false kai false break; if (cnt % 1000 == 0) {
				System.gc();
			} cnt % 1000 == 0 cnt % 1000 cnt 1000 0 {
				System.gc();
			} System.gc() System.gc System cnt++ cnt System.gc() System.gc System if (kai == true) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		} kai == true kai true {
			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" scan.close() scan.close scan String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.nextLine();
		int cnt = 0;
		
		boolean kai = true;
		
		while (S.length() > 0) {
			
			if (S.endsWith("dream")) {
				S =  new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("dreamer")) {
				S = new String(S.substring(0,S.length() - 7));
			} else if (S.endsWith("erase")) {
				S = new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("eraser")) {
				S = new String(S.substring(0,S.length() - 6));
			} else {
				kai = false;
				break;
			}
			
			if (cnt % 1000 == 0) {
				System.gc();
			}
			
			cnt++;
			
		}
		
		System.gc();
		
		if (kai == true) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		 
		 scan.close();

	}
} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.nextLine();
		int cnt = 0;
		
		boolean kai = true;
		
		while (S.length() > 0) {
			
			if (S.endsWith("dream")) {
				S =  new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("dreamer")) {
				S = new String(S.substring(0,S.length() - 7));
			} else if (S.endsWith("erase")) {
				S = new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("eraser")) {
				S = new String(S.substring(0,S.length() - 6));
			} else {
				kai = false;
				break;
			}
			
			if (cnt % 1000 == 0) {
				System.gc();
			}
			
			cnt++;
			
		}
		
		System.gc();
		
		if (kai == true) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		 
		 scan.close();

	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.nextLine();
		int cnt = 0;
		
		boolean kai = true;
		
		while (S.length() > 0) {
			
			if (S.endsWith("dream")) {
				S =  new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("dreamer")) {
				S = new String(S.substring(0,S.length() - 7));
			} else if (S.endsWith("erase")) {
				S = new String(S.substring(0,S.length() - 5));
			} else if (S.endsWith("eraser")) {
				S = new String(S.substring(0,S.length() - 6));
			} else {
				kai = false;
				break;
			}
			
			if (cnt % 1000 == 0) {
				System.gc();
			}
			
			cnt++;
			
		}
		
		System.gc();
		
		if (kai == true) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		 
		 scan.close();

	}
}