import java.io.*;
import java.math.*;
import java.util.*;
public class Main { 

	public static void main(String[] args) { 
		Scanner input = new Scanner(System.in); 
		String S = input.next();
		int N = S.length();
		int curSTART=0;
		boolean bad=false;
		while (curSTART<N) {
			if (curSTART+5<=N) {
				String test = S.substring(curSTART,curSTART+5);
				if (test.equals("dream")) {
					curSTART+=5;
					if (curSTART+2<=N) {
						if (S.substring(curSTART,curSTART+2).equals("er")) {
							curSTART+=2;
						}
					}
					if (curSTART+1<=N) {
						if (S.substring(curSTART,curSTART+1).equals("a")) {
							curSTART-=2;
							//Reset due to erase word being after dream 
							//(not dreamer)
						}
					}
				}else if (test.equals("erase")) {
					curSTART+=5;
					if (curSTART<N) {
						if (S.charAt(curSTART)=='r') curSTART++;
					}
				}else {
					bad=true;
				}
			}else {
				if (N-curSTART>1) {
					bad=true;
					break;
				} 
			}
			if (bad) break;
		}
		System.out.println(bad?"NO":"YES");
	}	
} import java.io.*; io.* java import java.math.*; math.* java import java.util.*; util.* java public class Main { 

	public static void main(String[] args) { 
		Scanner input = new Scanner(System.in); 
		String S = input.next();
		int N = S.length();
		int curSTART=0;
		boolean bad=false;
		while (curSTART<N) {
			if (curSTART+5<=N) {
				String test = S.substring(curSTART,curSTART+5);
				if (test.equals("dream")) {
					curSTART+=5;
					if (curSTART+2<=N) {
						if (S.substring(curSTART,curSTART+2).equals("er")) {
							curSTART+=2;
						}
					}
					if (curSTART+1<=N) {
						if (S.substring(curSTART,curSTART+1).equals("a")) {
							curSTART-=2;
							//Reset due to erase word being after dream 
							//(not dreamer)
						}
					}
				}else if (test.equals("erase")) {
					curSTART+=5;
					if (curSTART<N) {
						if (S.charAt(curSTART)=='r') curSTART++;
					}
				}else {
					bad=true;
				}
			}else {
				if (N-curSTART>1) {
					bad=true;
					break;
				} 
			}
			if (bad) break;
		}
		System.out.println(bad?"NO":"YES");
	}	
} Main public static void main(String[] args) { 
		Scanner input = new Scanner(System.in); 
		String S = input.next();
		int N = S.length();
		int curSTART=0;
		boolean bad=false;
		while (curSTART<N) {
			if (curSTART+5<=N) {
				String test = S.substring(curSTART,curSTART+5);
				if (test.equals("dream")) {
					curSTART+=5;
					if (curSTART+2<=N) {
						if (S.substring(curSTART,curSTART+2).equals("er")) {
							curSTART+=2;
						}
					}
					if (curSTART+1<=N) {
						if (S.substring(curSTART,curSTART+1).equals("a")) {
							curSTART-=2;
							//Reset due to erase word being after dream 
							//(not dreamer)
						}
					}
				}else if (test.equals("erase")) {
					curSTART+=5;
					if (curSTART<N) {
						if (S.charAt(curSTART)=='r') curSTART++;
					}
				}else {
					bad=true;
				}
			}else {
				if (N-curSTART>1) {
					bad=true;
					break;
				} 
			}
			if (bad) break;
		}
		System.out.println(bad?"NO":"YES");
	} main { 
		Scanner input = new Scanner(System.in); 
		String S = input.next();
		int N = S.length();
		int curSTART=0;
		boolean bad=false;
		while (curSTART<N) {
			if (curSTART+5<=N) {
				String test = S.substring(curSTART,curSTART+5);
				if (test.equals("dream")) {
					curSTART+=5;
					if (curSTART+2<=N) {
						if (S.substring(curSTART,curSTART+2).equals("er")) {
							curSTART+=2;
						}
					}
					if (curSTART+1<=N) {
						if (S.substring(curSTART,curSTART+1).equals("a")) {
							curSTART-=2;
							//Reset due to erase word being after dream 
							//(not dreamer)
						}
					}
				}else if (test.equals("erase")) {
					curSTART+=5;
					if (curSTART<N) {
						if (S.charAt(curSTART)=='r') curSTART++;
					}
				}else {
					bad=true;
				}
			}else {
				if (N-curSTART>1) {
					bad=true;
					break;
				} 
			}
			if (bad) break;
		}
		System.out.println(bad?"NO":"YES");
	} Scanner input = new Scanner(System.in); input new Scanner(System.in) String S = input.next(); S input.next() input.next input int N = S.length(); N S.length() S.length S int curSTART=0; curSTART 0 boolean bad=false; bad false while (curSTART<N) {
			if (curSTART+5<=N) {
				String test = S.substring(curSTART,curSTART+5);
				if (test.equals("dream")) {
					curSTART+=5;
					if (curSTART+2<=N) {
						if (S.substring(curSTART,curSTART+2).equals("er")) {
							curSTART+=2;
						}
					}
					if (curSTART+1<=N) {
						if (S.substring(curSTART,curSTART+1).equals("a")) {
							curSTART-=2;
							//Reset due to erase word being after dream 
							//(not dreamer)
						}
					}
				}else if (test.equals("erase")) {
					curSTART+=5;
					if (curSTART<N) {
						if (S.charAt(curSTART)=='r') curSTART++;
					}
				}else {
					bad=true;
				}
			}else {
				if (N-curSTART>1) {
					bad=true;
					break;
				} 
			}
			if (bad) break;
		} curSTART<N curSTART N {
			if (curSTART+5<=N) {
				String test = S.substring(curSTART,curSTART+5);
				if (test.equals("dream")) {
					curSTART+=5;
					if (curSTART+2<=N) {
						if (S.substring(curSTART,curSTART+2).equals("er")) {
							curSTART+=2;
						}
					}
					if (curSTART+1<=N) {
						if (S.substring(curSTART,curSTART+1).equals("a")) {
							curSTART-=2;
							//Reset due to erase word being after dream 
							//(not dreamer)
						}
					}
				}else if (test.equals("erase")) {
					curSTART+=5;
					if (curSTART<N) {
						if (S.charAt(curSTART)=='r') curSTART++;
					}
				}else {
					bad=true;
				}
			}else {
				if (N-curSTART>1) {
					bad=true;
					break;
				} 
			}
			if (bad) break;
		} if (curSTART+5<=N) {
				String test = S.substring(curSTART,curSTART+5);
				if (test.equals("dream")) {
					curSTART+=5;
					if (curSTART+2<=N) {
						if (S.substring(curSTART,curSTART+2).equals("er")) {
							curSTART+=2;
						}
					}
					if (curSTART+1<=N) {
						if (S.substring(curSTART,curSTART+1).equals("a")) {
							curSTART-=2;
							//Reset due to erase word being after dream 
							//(not dreamer)
						}
					}
				}else if (test.equals("erase")) {
					curSTART+=5;
					if (curSTART<N) {
						if (S.charAt(curSTART)=='r') curSTART++;
					}
				}else {
					bad=true;
				}
			}else {
				if (N-curSTART>1) {
					bad=true;
					break;
				} 
			} curSTART+5<=N curSTART+5 curSTART 5 N {
				String test = S.substring(curSTART,curSTART+5);
				if (test.equals("dream")) {
					curSTART+=5;
					if (curSTART+2<=N) {
						if (S.substring(curSTART,curSTART+2).equals("er")) {
							curSTART+=2;
						}
					}
					if (curSTART+1<=N) {
						if (S.substring(curSTART,curSTART+1).equals("a")) {
							curSTART-=2;
							//Reset due to erase word being after dream 
							//(not dreamer)
						}
					}
				}else if (test.equals("erase")) {
					curSTART+=5;
					if (curSTART<N) {
						if (S.charAt(curSTART)=='r') curSTART++;
					}
				}else {
					bad=true;
				}
			} String test = S.substring(curSTART,curSTART+5); test S.substring(curSTART,curSTART+5) S.substring S curSTART curSTART+5 curSTART 5 if (test.equals("dream")) {
					curSTART+=5;
					if (curSTART+2<=N) {
						if (S.substring(curSTART,curSTART+2).equals("er")) {
							curSTART+=2;
						}
					}
					if (curSTART+1<=N) {
						if (S.substring(curSTART,curSTART+1).equals("a")) {
							curSTART-=2;
							//Reset due to erase word being after dream 
							//(not dreamer)
						}
					}
				}else if (test.equals("erase")) {
					curSTART+=5;
					if (curSTART<N) {
						if (S.charAt(curSTART)=='r') curSTART++;
					}
				}else {
					bad=true;
				} test.equals("dream") test.equals test "dream" {
					curSTART+=5;
					if (curSTART+2<=N) {
						if (S.substring(curSTART,curSTART+2).equals("er")) {
							curSTART+=2;
						}
					}
					if (curSTART+1<=N) {
						if (S.substring(curSTART,curSTART+1).equals("a")) {
							curSTART-=2;
							//Reset due to erase word being after dream 
							//(not dreamer)
						}
					}
				} curSTART+=5 curSTART 5 if (curSTART+2<=N) {
						if (S.substring(curSTART,curSTART+2).equals("er")) {
							curSTART+=2;
						}
					} curSTART+2<=N curSTART+2 curSTART 2 N {
						if (S.substring(curSTART,curSTART+2).equals("er")) {
							curSTART+=2;
						}
					} if (S.substring(curSTART,curSTART+2).equals("er")) {
							curSTART+=2;
						} S.substring(curSTART,curSTART+2).equals("er") S.substring(curSTART,curSTART+2).equals S.substring(curSTART,curSTART+2) S.substring S curSTART curSTART+2 curSTART 2 "er" {
							curSTART+=2;
						} curSTART+=2 curSTART 2 if (curSTART+1<=N) {
						if (S.substring(curSTART,curSTART+1).equals("a")) {
							curSTART-=2;
							//Reset due to erase word being after dream 
							//(not dreamer)
						}
					} curSTART+1<=N curSTART+1 curSTART 1 N {
						if (S.substring(curSTART,curSTART+1).equals("a")) {
							curSTART-=2;
							//Reset due to erase word being after dream 
							//(not dreamer)
						}
					} if (S.substring(curSTART,curSTART+1).equals("a")) {
							curSTART-=2;
							//Reset due to erase word being after dream 
							//(not dreamer)
						} S.substring(curSTART,curSTART+1).equals("a") S.substring(curSTART,curSTART+1).equals S.substring(curSTART,curSTART+1) S.substring S curSTART curSTART+1 curSTART 1 "a" {
							curSTART-=2;
							//Reset due to erase word being after dream 
							//(not dreamer)
						} curSTART-=2 curSTART 2 if (test.equals("erase")) {
					curSTART+=5;
					if (curSTART<N) {
						if (S.charAt(curSTART)=='r') curSTART++;
					}
				}else {
					bad=true;
				} test.equals("erase") test.equals test "erase" {
					curSTART+=5;
					if (curSTART<N) {
						if (S.charAt(curSTART)=='r') curSTART++;
					}
				} curSTART+=5 curSTART 5 if (curSTART<N) {
						if (S.charAt(curSTART)=='r') curSTART++;
					} curSTART<N curSTART N {
						if (S.charAt(curSTART)=='r') curSTART++;
					} if (S.charAt(curSTART)=='r') curSTART++; S.charAt(curSTART)=='r' S.charAt(curSTART) S.charAt S curSTART 'r' curSTART++ curSTART {
					bad=true;
				} bad=true bad true {
				if (N-curSTART>1) {
					bad=true;
					break;
				} 
			} if (N-curSTART>1) {
					bad=true;
					break;
				} N-curSTART>1 N-curSTART N curSTART 1 {
					bad=true;
					break;
				} bad=true bad true break; if (bad) break; bad break; System.out.println(bad?"NO":"YES") System.out.println System.out System System.out bad?"NO":"YES" bad "NO" "YES" String[] args args public class Main { 

	public static void main(String[] args) { 
		Scanner input = new Scanner(System.in); 
		String S = input.next();
		int N = S.length();
		int curSTART=0;
		boolean bad=false;
		while (curSTART<N) {
			if (curSTART+5<=N) {
				String test = S.substring(curSTART,curSTART+5);
				if (test.equals("dream")) {
					curSTART+=5;
					if (curSTART+2<=N) {
						if (S.substring(curSTART,curSTART+2).equals("er")) {
							curSTART+=2;
						}
					}
					if (curSTART+1<=N) {
						if (S.substring(curSTART,curSTART+1).equals("a")) {
							curSTART-=2;
							//Reset due to erase word being after dream 
							//(not dreamer)
						}
					}
				}else if (test.equals("erase")) {
					curSTART+=5;
					if (curSTART<N) {
						if (S.charAt(curSTART)=='r') curSTART++;
					}
				}else {
					bad=true;
				}
			}else {
				if (N-curSTART>1) {
					bad=true;
					break;
				} 
			}
			if (bad) break;
		}
		System.out.println(bad?"NO":"YES");
	}	
} public class Main { 

	public static void main(String[] args) { 
		Scanner input = new Scanner(System.in); 
		String S = input.next();
		int N = S.length();
		int curSTART=0;
		boolean bad=false;
		while (curSTART<N) {
			if (curSTART+5<=N) {
				String test = S.substring(curSTART,curSTART+5);
				if (test.equals("dream")) {
					curSTART+=5;
					if (curSTART+2<=N) {
						if (S.substring(curSTART,curSTART+2).equals("er")) {
							curSTART+=2;
						}
					}
					if (curSTART+1<=N) {
						if (S.substring(curSTART,curSTART+1).equals("a")) {
							curSTART-=2;
							//Reset due to erase word being after dream 
							//(not dreamer)
						}
					}
				}else if (test.equals("erase")) {
					curSTART+=5;
					if (curSTART<N) {
						if (S.charAt(curSTART)=='r') curSTART++;
					}
				}else {
					bad=true;
				}
			}else {
				if (N-curSTART>1) {
					bad=true;
					break;
				} 
			}
			if (bad) break;
		}
		System.out.println(bad?"NO":"YES");
	}	
} Main
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { 

	public static void main(String[] args) { 
		Scanner input = new Scanner(System.in); 
		String S = input.next();
		int N = S.length();
		int curSTART=0;
		boolean bad=false;
		while (curSTART<N) {
			if (curSTART+5<=N) {
				String test = S.substring(curSTART,curSTART+5);
				if (test.equals("dream")) {
					curSTART+=5;
					if (curSTART+2<=N) {
						if (S.substring(curSTART,curSTART+2).equals("er")) {
							curSTART+=2;
						}
					}
					if (curSTART+1<=N) {
						if (S.substring(curSTART,curSTART+1).equals("a")) {
							curSTART-=2;
							//Reset due to erase word being after dream 
							//(not dreamer)
						}
					}
				}else if (test.equals("erase")) {
					curSTART+=5;
					if (curSTART<N) {
						if (S.charAt(curSTART)=='r') curSTART++;
					}
				}else {
					bad=true;
				}
			}else {
				if (N-curSTART>1) {
					bad=true;
					break;
				} 
			}
			if (bad) break;
		}
		System.out.println(bad?"NO":"YES");
	}	
}