import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;

class Main {
	String s;
	String[] d = { "dream", "dreamer", "erase", "eraser" };

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Main m = new Main(sc);
		m.solve();
		sc.close();
	}

	Main(Scanner sc) {
		s = sc.next();
	}

	void solve() {
		Queue<Integer> q = new ArrayDeque<Integer>();
		q.offer(0);
		while(q.size()>0){
			int i = q.poll();
			for(int j=0;j<4;j++){
				if(i+d[j].length()>s.length()) continue;
				if(d[j].equals(s.substring(i,i+d[j].length()))){
					if(i+d[j].length()==s.length()){
						System.out.println("YES");
						System.exit(0);
					}
					q.offer(i+d[j].length());
				}
			}
		}
		System.out.println("NO");
	}
} import java.util.ArrayDeque; ArrayDeque java.util import java.util.Queue; Queue java.util import java.util.Scanner; Scanner java.util class Main {
	String s;
	String[] d = { "dream", "dreamer", "erase", "eraser" };

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Main m = new Main(sc);
		m.solve();
		sc.close();
	}

	Main(Scanner sc) {
		s = sc.next();
	}

	void solve() {
		Queue<Integer> q = new ArrayDeque<Integer>();
		q.offer(0);
		while(q.size()>0){
			int i = q.poll();
			for(int j=0;j<4;j++){
				if(i+d[j].length()>s.length()) continue;
				if(d[j].equals(s.substring(i,i+d[j].length()))){
					if(i+d[j].length()==s.length()){
						System.out.println("YES");
						System.exit(0);
					}
					q.offer(i+d[j].length());
				}
			}
		}
		System.out.println("NO");
	}
} Main String s; s String[] d = { "dream", "dreamer", "erase", "eraser" }; d { "dream", "dreamer", "erase", "eraser" } "dream" "dreamer" "erase" "eraser" public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Main m = new Main(sc);
		m.solve();
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		Main m = new Main(sc);
		m.solve();
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Main m = new Main(sc); m new Main(sc) m.solve() m.solve m sc.close() sc.close sc String[] args args Main(Scanner sc) {
		s = sc.next();
	} Main {
		s = sc.next();
	} s = sc.next() s sc.next() sc.next sc Scanner sc sc void solve() {
		Queue<Integer> q = new ArrayDeque<Integer>();
		q.offer(0);
		while(q.size()>0){
			int i = q.poll();
			for(int j=0;j<4;j++){
				if(i+d[j].length()>s.length()) continue;
				if(d[j].equals(s.substring(i,i+d[j].length()))){
					if(i+d[j].length()==s.length()){
						System.out.println("YES");
						System.exit(0);
					}
					q.offer(i+d[j].length());
				}
			}
		}
		System.out.println("NO");
	} solve {
		Queue<Integer> q = new ArrayDeque<Integer>();
		q.offer(0);
		while(q.size()>0){
			int i = q.poll();
			for(int j=0;j<4;j++){
				if(i+d[j].length()>s.length()) continue;
				if(d[j].equals(s.substring(i,i+d[j].length()))){
					if(i+d[j].length()==s.length()){
						System.out.println("YES");
						System.exit(0);
					}
					q.offer(i+d[j].length());
				}
			}
		}
		System.out.println("NO");
	} Queue<Integer> q = new ArrayDeque<Integer>(); q new ArrayDeque<Integer>() q.offer(0) q.offer q 0 while(q.size()>0){
			int i = q.poll();
			for(int j=0;j<4;j++){
				if(i+d[j].length()>s.length()) continue;
				if(d[j].equals(s.substring(i,i+d[j].length()))){
					if(i+d[j].length()==s.length()){
						System.out.println("YES");
						System.exit(0);
					}
					q.offer(i+d[j].length());
				}
			}
		} q.size()>0 q.size() q.size q 0 {
			int i = q.poll();
			for(int j=0;j<4;j++){
				if(i+d[j].length()>s.length()) continue;
				if(d[j].equals(s.substring(i,i+d[j].length()))){
					if(i+d[j].length()==s.length()){
						System.out.println("YES");
						System.exit(0);
					}
					q.offer(i+d[j].length());
				}
			}
		} int i = q.poll(); i q.poll() q.poll q for(int j=0;j<4;j++){
				if(i+d[j].length()>s.length()) continue;
				if(d[j].equals(s.substring(i,i+d[j].length()))){
					if(i+d[j].length()==s.length()){
						System.out.println("YES");
						System.exit(0);
					}
					q.offer(i+d[j].length());
				}
			} int j=0; int j=0; j 0 j<4 j 4 j++ j++ j {
				if(i+d[j].length()>s.length()) continue;
				if(d[j].equals(s.substring(i,i+d[j].length()))){
					if(i+d[j].length()==s.length()){
						System.out.println("YES");
						System.exit(0);
					}
					q.offer(i+d[j].length());
				}
			} {
				if(i+d[j].length()>s.length()) continue;
				if(d[j].equals(s.substring(i,i+d[j].length()))){
					if(i+d[j].length()==s.length()){
						System.out.println("YES");
						System.exit(0);
					}
					q.offer(i+d[j].length());
				}
			} if(i+d[j].length()>s.length()) continue; i+d[j].length()>s.length() i+d[j].length() i d[j].length() d[j].length d[j] d j s.length() s.length s continue; if(d[j].equals(s.substring(i,i+d[j].length()))){
					if(i+d[j].length()==s.length()){
						System.out.println("YES");
						System.exit(0);
					}
					q.offer(i+d[j].length());
				} d[j].equals(s.substring(i,i+d[j].length())) d[j].equals d[j] d j s.substring(i,i+d[j].length()) s.substring s i i+d[j].length() i d[j].length() d[j].length d[j] d j {
					if(i+d[j].length()==s.length()){
						System.out.println("YES");
						System.exit(0);
					}
					q.offer(i+d[j].length());
				} if(i+d[j].length()==s.length()){
						System.out.println("YES");
						System.exit(0);
					} i+d[j].length()==s.length() i+d[j].length() i d[j].length() d[j].length d[j] d j s.length() s.length s {
						System.out.println("YES");
						System.exit(0);
					} System.out.println("YES") System.out.println System.out System System.out "YES" System.exit(0) System.exit System 0 q.offer(i+d[j].length()) q.offer q i+d[j].length() i d[j].length() d[j].length d[j] d j System.out.println("NO") System.out.println System.out System System.out "NO"
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;

class Main {
	String s;
	String[] d = { "dream", "dreamer", "erase", "eraser" };

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Main m = new Main(sc);
		m.solve();
		sc.close();
	}

	Main(Scanner sc) {
		s = sc.next();
	}

	void solve() {
		Queue<Integer> q = new ArrayDeque<Integer>();
		q.offer(0);
		while(q.size()>0){
			int i = q.poll();
			for(int j=0;j<4;j++){
				if(i+d[j].length()>s.length()) continue;
				if(d[j].equals(s.substring(i,i+d[j].length()))){
					if(i+d[j].length()==s.length()){
						System.out.println("YES");
						System.exit(0);
					}
					q.offer(i+d[j].length());
				}
			}
		}
		System.out.println("NO");
	}
}