import java.util.Scanner;
public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.nextLine();
		
		int end = 0;
		String[] map = {"dream", "dreamer", "erase", "eraser"};
		while(end < S.length()) {
			boolean delete = false;
			for (String target: map) {
				if (S.length() - end - target.length() < 0) {
					continue;
				}
				
				if (S.substring(S.length() - end - target.length(), S.length() - end).equals(target)) {
					delete = true;
					end += target.length();
					break;
				}
			}
			
			if (!delete) {
				System.out.println("NO");
				return;
			}
		}
		
		System.out.println("YES");
	}
} import java.util.Scanner; Scanner java.util public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.nextLine();
		
		int end = 0;
		String[] map = {"dream", "dreamer", "erase", "eraser"};
		while(end < S.length()) {
			boolean delete = false;
			for (String target: map) {
				if (S.length() - end - target.length() < 0) {
					continue;
				}
				
				if (S.substring(S.length() - end - target.length(), S.length() - end).equals(target)) {
					delete = true;
					end += target.length();
					break;
				}
			}
			
			if (!delete) {
				System.out.println("NO");
				return;
			}
		}
		
		System.out.println("YES");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.nextLine();
		
		int end = 0;
		String[] map = {"dream", "dreamer", "erase", "eraser"};
		while(end < S.length()) {
			boolean delete = false;
			for (String target: map) {
				if (S.length() - end - target.length() < 0) {
					continue;
				}
				
				if (S.substring(S.length() - end - target.length(), S.length() - end).equals(target)) {
					delete = true;
					end += target.length();
					break;
				}
			}
			
			if (!delete) {
				System.out.println("NO");
				return;
			}
		}
		
		System.out.println("YES");
	} main {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.nextLine();
		
		int end = 0;
		String[] map = {"dream", "dreamer", "erase", "eraser"};
		while(end < S.length()) {
			boolean delete = false;
			for (String target: map) {
				if (S.length() - end - target.length() < 0) {
					continue;
				}
				
				if (S.substring(S.length() - end - target.length(), S.length() - end).equals(target)) {
					delete = true;
					end += target.length();
					break;
				}
			}
			
			if (!delete) {
				System.out.println("NO");
				return;
			}
		}
		
		System.out.println("YES");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.nextLine(); S sc.nextLine() sc.nextLine sc int end = 0; end 0 String[] map = {"dream", "dreamer", "erase", "eraser"}; map {"dream", "dreamer", "erase", "eraser"} "dream" "dreamer" "erase" "eraser" while(end < S.length()) {
			boolean delete = false;
			for (String target: map) {
				if (S.length() - end - target.length() < 0) {
					continue;
				}
				
				if (S.substring(S.length() - end - target.length(), S.length() - end).equals(target)) {
					delete = true;
					end += target.length();
					break;
				}
			}
			
			if (!delete) {
				System.out.println("NO");
				return;
			}
		} end < S.length() end S.length() S.length S {
			boolean delete = false;
			for (String target: map) {
				if (S.length() - end - target.length() < 0) {
					continue;
				}
				
				if (S.substring(S.length() - end - target.length(), S.length() - end).equals(target)) {
					delete = true;
					end += target.length();
					break;
				}
			}
			
			if (!delete) {
				System.out.println("NO");
				return;
			}
		} boolean delete = false; delete false for (String target: map) {
				if (S.length() - end - target.length() < 0) {
					continue;
				}
				
				if (S.substring(S.length() - end - target.length(), S.length() - end).equals(target)) {
					delete = true;
					end += target.length();
					break;
				}
			} String target map {
				if (S.length() - end - target.length() < 0) {
					continue;
				}
				
				if (S.substring(S.length() - end - target.length(), S.length() - end).equals(target)) {
					delete = true;
					end += target.length();
					break;
				}
			} {
				if (S.length() - end - target.length() < 0) {
					continue;
				}
				
				if (S.substring(S.length() - end - target.length(), S.length() - end).equals(target)) {
					delete = true;
					end += target.length();
					break;
				}
			} if (S.length() - end - target.length() < 0) {
					continue;
				} S.length() - end - target.length() < 0 S.length() - end - target.length() S.length() - end - target.length() S.length() S.length S end target.length() target.length target 0 {
					continue;
				} continue; if (S.substring(S.length() - end - target.length(), S.length() - end).equals(target)) {
					delete = true;
					end += target.length();
					break;
				} S.substring(S.length() - end - target.length(), S.length() - end).equals(target) S.substring(S.length() - end - target.length(), S.length() - end).equals S.substring(S.length() - end - target.length(), S.length() - end) S.substring S S.length() - end - target.length() S.length() - end - target.length() S.length() S.length S end target.length() target.length target S.length() - end S.length() S.length S end target {
					delete = true;
					end += target.length();
					break;
				} delete = true delete true end += target.length() end target.length() target.length target break; if (!delete) {
				System.out.println("NO");
				return;
			} !delete delete {
				System.out.println("NO");
				return;
			} System.out.println("NO") System.out.println System.out System System.out "NO" return; System.out.println("YES") System.out.println System.out System System.out "YES" String[] args args public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.nextLine();
		
		int end = 0;
		String[] map = {"dream", "dreamer", "erase", "eraser"};
		while(end < S.length()) {
			boolean delete = false;
			for (String target: map) {
				if (S.length() - end - target.length() < 0) {
					continue;
				}
				
				if (S.substring(S.length() - end - target.length(), S.length() - end).equals(target)) {
					delete = true;
					end += target.length();
					break;
				}
			}
			
			if (!delete) {
				System.out.println("NO");
				return;
			}
		}
		
		System.out.println("YES");
	}
} public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.nextLine();
		
		int end = 0;
		String[] map = {"dream", "dreamer", "erase", "eraser"};
		while(end < S.length()) {
			boolean delete = false;
			for (String target: map) {
				if (S.length() - end - target.length() < 0) {
					continue;
				}
				
				if (S.substring(S.length() - end - target.length(), S.length() - end).equals(target)) {
					delete = true;
					end += target.length();
					break;
				}
			}
			
			if (!delete) {
				System.out.println("NO");
				return;
			}
		}
		
		System.out.println("YES");
	}
} Main
import java.util.Scanner;
public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.nextLine();
		
		int end = 0;
		String[] map = {"dream", "dreamer", "erase", "eraser"};
		while(end < S.length()) {
			boolean delete = false;
			for (String target: map) {
				if (S.length() - end - target.length() < 0) {
					continue;
				}
				
				if (S.substring(S.length() - end - target.length(), S.length() - end).equals(target)) {
					delete = true;
					end += target.length();
					break;
				}
			}
			
			if (!delete) {
				System.out.println("NO");
				return;
			}
		}
		
		System.out.println("YES");
	}
}