import java.util.*;

public class Main {
    static long total = 0;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] targets = new String[]{"dream", "dreamer", "erase", "eraser"};
		StringBuilder sb = new StringBuilder(sc.next());
		while (sb.length() > 0) {
		    boolean flag = false;
		    for (String s : targets) {
		        if (sb.length() >= s.length() && sb.lastIndexOf(s) == sb.length() - s.length()) {
		            flag = true;
		            sb.setLength(sb.length() - s.length());
		            break;
		        }
		    }
		    if (!flag) {
		        System.out.println("NO");
		        return;
		    }
		}
		System.out.println("YES");
	}
} import java.util.*; util.* java public class Main {
    static long total = 0;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] targets = new String[]{"dream", "dreamer", "erase", "eraser"};
		StringBuilder sb = new StringBuilder(sc.next());
		while (sb.length() > 0) {
		    boolean flag = false;
		    for (String s : targets) {
		        if (sb.length() >= s.length() && sb.lastIndexOf(s) == sb.length() - s.length()) {
		            flag = true;
		            sb.setLength(sb.length() - s.length());
		            break;
		        }
		    }
		    if (!flag) {
		        System.out.println("NO");
		        return;
		    }
		}
		System.out.println("YES");
	}
} Main static long total = 0; total 0 public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] targets = new String[]{"dream", "dreamer", "erase", "eraser"};
		StringBuilder sb = new StringBuilder(sc.next());
		while (sb.length() > 0) {
		    boolean flag = false;
		    for (String s : targets) {
		        if (sb.length() >= s.length() && sb.lastIndexOf(s) == sb.length() - s.length()) {
		            flag = true;
		            sb.setLength(sb.length() - s.length());
		            break;
		        }
		    }
		    if (!flag) {
		        System.out.println("NO");
		        return;
		    }
		}
		System.out.println("YES");
	} main {
		Scanner sc = new Scanner(System.in);
		String[] targets = new String[]{"dream", "dreamer", "erase", "eraser"};
		StringBuilder sb = new StringBuilder(sc.next());
		while (sb.length() > 0) {
		    boolean flag = false;
		    for (String s : targets) {
		        if (sb.length() >= s.length() && sb.lastIndexOf(s) == sb.length() - s.length()) {
		            flag = true;
		            sb.setLength(sb.length() - s.length());
		            break;
		        }
		    }
		    if (!flag) {
		        System.out.println("NO");
		        return;
		    }
		}
		System.out.println("YES");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] targets = new String[]{"dream", "dreamer", "erase", "eraser"}; targets new String[]{"dream", "dreamer", "erase", "eraser"} StringBuilder sb = new StringBuilder(sc.next()); sb new StringBuilder(sc.next()) while (sb.length() > 0) {
		    boolean flag = false;
		    for (String s : targets) {
		        if (sb.length() >= s.length() && sb.lastIndexOf(s) == sb.length() - s.length()) {
		            flag = true;
		            sb.setLength(sb.length() - s.length());
		            break;
		        }
		    }
		    if (!flag) {
		        System.out.println("NO");
		        return;
		    }
		} sb.length() > 0 sb.length() sb.length sb 0 {
		    boolean flag = false;
		    for (String s : targets) {
		        if (sb.length() >= s.length() && sb.lastIndexOf(s) == sb.length() - s.length()) {
		            flag = true;
		            sb.setLength(sb.length() - s.length());
		            break;
		        }
		    }
		    if (!flag) {
		        System.out.println("NO");
		        return;
		    }
		} boolean flag = false; flag false for (String s : targets) {
		        if (sb.length() >= s.length() && sb.lastIndexOf(s) == sb.length() - s.length()) {
		            flag = true;
		            sb.setLength(sb.length() - s.length());
		            break;
		        }
		    } String s targets {
		        if (sb.length() >= s.length() && sb.lastIndexOf(s) == sb.length() - s.length()) {
		            flag = true;
		            sb.setLength(sb.length() - s.length());
		            break;
		        }
		    } {
		        if (sb.length() >= s.length() && sb.lastIndexOf(s) == sb.length() - s.length()) {
		            flag = true;
		            sb.setLength(sb.length() - s.length());
		            break;
		        }
		    } if (sb.length() >= s.length() && sb.lastIndexOf(s) == sb.length() - s.length()) {
		            flag = true;
		            sb.setLength(sb.length() - s.length());
		            break;
		        } sb.length() >= s.length() && sb.lastIndexOf(s) == sb.length() - s.length() sb.length() >= s.length() sb.length() sb.length sb s.length() s.length s sb.lastIndexOf(s) == sb.length() - s.length() sb.lastIndexOf(s) sb.lastIndexOf sb s sb.length() - s.length() sb.length() sb.length sb s.length() s.length s {
		            flag = true;
		            sb.setLength(sb.length() - s.length());
		            break;
		        } flag = true flag true sb.setLength(sb.length() - s.length()) sb.setLength sb sb.length() - s.length() sb.length() sb.length sb s.length() s.length s break; if (!flag) {
		        System.out.println("NO");
		        return;
		    } !flag flag {
		        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 {
    static long total = 0;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] targets = new String[]{"dream", "dreamer", "erase", "eraser"};
		StringBuilder sb = new StringBuilder(sc.next());
		while (sb.length() > 0) {
		    boolean flag = false;
		    for (String s : targets) {
		        if (sb.length() >= s.length() && sb.lastIndexOf(s) == sb.length() - s.length()) {
		            flag = true;
		            sb.setLength(sb.length() - s.length());
		            break;
		        }
		    }
		    if (!flag) {
		        System.out.println("NO");
		        return;
		    }
		}
		System.out.println("YES");
	}
} public class Main {
    static long total = 0;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] targets = new String[]{"dream", "dreamer", "erase", "eraser"};
		StringBuilder sb = new StringBuilder(sc.next());
		while (sb.length() > 0) {
		    boolean flag = false;
		    for (String s : targets) {
		        if (sb.length() >= s.length() && sb.lastIndexOf(s) == sb.length() - s.length()) {
		            flag = true;
		            sb.setLength(sb.length() - s.length());
		            break;
		        }
		    }
		    if (!flag) {
		        System.out.println("NO");
		        return;
		    }
		}
		System.out.println("YES");
	}
} Main
import java.util.*;

public class Main {
    static long total = 0;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] targets = new String[]{"dream", "dreamer", "erase", "eraser"};
		StringBuilder sb = new StringBuilder(sc.next());
		while (sb.length() > 0) {
		    boolean flag = false;
		    for (String s : targets) {
		        if (sb.length() >= s.length() && sb.lastIndexOf(s) == sb.length() - s.length()) {
		            flag = true;
		            sb.setLength(sb.length() - s.length());
		            break;
		        }
		    }
		    if (!flag) {
		        System.out.println("NO");
		        return;
		    }
		}
		System.out.println("YES");
	}
}
