import java.util.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		i = s.length();
		boolean f = true;
		int ss = 0;
		String[] t = {"dream","dreamer","erase","eraser"};
		while(i>0) {
			boolean f2 = false;
			for(j=0;j<t.length;j++) {
				ss = i - t[j].length();
				if(ss>=0) {
					if(s.substring(ss, i).equals(t[j])) {
						f2 = true;
						i=ss;
						break;
					}
				}
			}
			if(!f2) {
				f = false;
				break;
			}
		}
		String ans=f?"YES":"NO";
		System.out.println(ans);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		i = s.length();
		boolean f = true;
		int ss = 0;
		String[] t = {"dream","dreamer","erase","eraser"};
		while(i>0) {
			boolean f2 = false;
			for(j=0;j<t.length;j++) {
				ss = i - t[j].length();
				if(ss>=0) {
					if(s.substring(ss, i).equals(t[j])) {
						f2 = true;
						i=ss;
						break;
					}
				}
			}
			if(!f2) {
				f = false;
				break;
			}
		}
		String ans=f?"YES":"NO";
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		i = s.length();
		boolean f = true;
		int ss = 0;
		String[] t = {"dream","dreamer","erase","eraser"};
		while(i>0) {
			boolean f2 = false;
			for(j=0;j<t.length;j++) {
				ss = i - t[j].length();
				if(ss>=0) {
					if(s.substring(ss, i).equals(t[j])) {
						f2 = true;
						i=ss;
						break;
					}
				}
			}
			if(!f2) {
				f = false;
				break;
			}
		}
		String ans=f?"YES":"NO";
		System.out.println(ans);
	} main {
		int i,j;
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		i = s.length();
		boolean f = true;
		int ss = 0;
		String[] t = {"dream","dreamer","erase","eraser"};
		while(i>0) {
			boolean f2 = false;
			for(j=0;j<t.length;j++) {
				ss = i - t[j].length();
				if(ss>=0) {
					if(s.substring(ss, i).equals(t[j])) {
						f2 = true;
						i=ss;
						break;
					}
				}
			}
			if(!f2) {
				f = false;
				break;
			}
		}
		String ans=f?"YES":"NO";
		System.out.println(ans);
	} int i i j; j Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc sc.close() sc.close sc i = s.length() i s.length() s.length s boolean f = true; f true int ss = 0; ss 0 String[] t = {"dream","dreamer","erase","eraser"}; t {"dream","dreamer","erase","eraser"} "dream" "dreamer" "erase" "eraser" while(i>0) {
			boolean f2 = false;
			for(j=0;j<t.length;j++) {
				ss = i - t[j].length();
				if(ss>=0) {
					if(s.substring(ss, i).equals(t[j])) {
						f2 = true;
						i=ss;
						break;
					}
				}
			}
			if(!f2) {
				f = false;
				break;
			}
		} i>0 i 0 {
			boolean f2 = false;
			for(j=0;j<t.length;j++) {
				ss = i - t[j].length();
				if(ss>=0) {
					if(s.substring(ss, i).equals(t[j])) {
						f2 = true;
						i=ss;
						break;
					}
				}
			}
			if(!f2) {
				f = false;
				break;
			}
		} boolean f2 = false; f2 false for(j=0;j<t.length;j++) {
				ss = i - t[j].length();
				if(ss>=0) {
					if(s.substring(ss, i).equals(t[j])) {
						f2 = true;
						i=ss;
						break;
					}
				}
			} j=0; j=0 j 0 j<t.length j t.length t t.length j++ j++ j {
				ss = i - t[j].length();
				if(ss>=0) {
					if(s.substring(ss, i).equals(t[j])) {
						f2 = true;
						i=ss;
						break;
					}
				}
			} {
				ss = i - t[j].length();
				if(ss>=0) {
					if(s.substring(ss, i).equals(t[j])) {
						f2 = true;
						i=ss;
						break;
					}
				}
			} ss = i - t[j].length() ss i - t[j].length() i t[j].length() t[j].length t[j] t j if(ss>=0) {
					if(s.substring(ss, i).equals(t[j])) {
						f2 = true;
						i=ss;
						break;
					}
				} ss>=0 ss 0 {
					if(s.substring(ss, i).equals(t[j])) {
						f2 = true;
						i=ss;
						break;
					}
				} if(s.substring(ss, i).equals(t[j])) {
						f2 = true;
						i=ss;
						break;
					} s.substring(ss, i).equals(t[j]) s.substring(ss, i).equals s.substring(ss, i) s.substring s ss i t[j] t j {
						f2 = true;
						i=ss;
						break;
					} f2 = true f2 true i=ss i ss break; if(!f2) {
				f = false;
				break;
			} !f2 f2 {
				f = false;
				break;
			} f = false f false break; String ans=f?"YES":"NO"; ans f?"YES":"NO" f "YES" "NO" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		i = s.length();
		boolean f = true;
		int ss = 0;
		String[] t = {"dream","dreamer","erase","eraser"};
		while(i>0) {
			boolean f2 = false;
			for(j=0;j<t.length;j++) {
				ss = i - t[j].length();
				if(ss>=0) {
					if(s.substring(ss, i).equals(t[j])) {
						f2 = true;
						i=ss;
						break;
					}
				}
			}
			if(!f2) {
				f = false;
				break;
			}
		}
		String ans=f?"YES":"NO";
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		i = s.length();
		boolean f = true;
		int ss = 0;
		String[] t = {"dream","dreamer","erase","eraser"};
		while(i>0) {
			boolean f2 = false;
			for(j=0;j<t.length;j++) {
				ss = i - t[j].length();
				if(ss>=0) {
					if(s.substring(ss, i).equals(t[j])) {
						f2 = true;
						i=ss;
						break;
					}
				}
			}
			if(!f2) {
				f = false;
				break;
			}
		}
		String ans=f?"YES":"NO";
		System.out.println(ans);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		i = s.length();
		boolean f = true;
		int ss = 0;
		String[] t = {"dream","dreamer","erase","eraser"};
		while(i>0) {
			boolean f2 = false;
			for(j=0;j<t.length;j++) {
				ss = i - t[j].length();
				if(ss>=0) {
					if(s.substring(ss, i).equals(t[j])) {
						f2 = true;
						i=ss;
						break;
					}
				}
			}
			if(!f2) {
				f = false;
				break;
			}
		}
		String ans=f?"YES":"NO";
		System.out.println(ans);
	}
}
