import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.next();
		StringBuffer str = new StringBuffer(S);
        S = str.reverse().toString();
        
        String[] divide = {"dream", "dreamer", "erase", "eraser"};
        for(int i = 0; i < 4; i++) {
        	StringBuffer d = new StringBuffer(divide[i]);
        	divide[i] = d.reverse().toString();
        }
        
        boolean can = true;
        for(int i = 0; i < S.length();) {
        	boolean flag = false;
        	for(int j = 0; j < 4; j++) {
        		String d = divide[j];
        		if(i+d.length() <= S.length() && S.substring(i, i+d.length()).equals(d)) {
        			flag = true;
        			i += d.length();
        		}
        	}
        	if(!flag) {
        		can = false;
        		break;
        	}
        }
        if(can) System.out.println("YES");
        else System.out.println("NO");

	}

} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.next();
		StringBuffer str = new StringBuffer(S);
        S = str.reverse().toString();
        
        String[] divide = {"dream", "dreamer", "erase", "eraser"};
        for(int i = 0; i < 4; i++) {
        	StringBuffer d = new StringBuffer(divide[i]);
        	divide[i] = d.reverse().toString();
        }
        
        boolean can = true;
        for(int i = 0; i < S.length();) {
        	boolean flag = false;
        	for(int j = 0; j < 4; j++) {
        		String d = divide[j];
        		if(i+d.length() <= S.length() && S.substring(i, i+d.length()).equals(d)) {
        			flag = true;
        			i += d.length();
        		}
        	}
        	if(!flag) {
        		can = false;
        		break;
        	}
        }
        if(can) System.out.println("YES");
        else System.out.println("NO");

	}

} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.next();
		StringBuffer str = new StringBuffer(S);
        S = str.reverse().toString();
        
        String[] divide = {"dream", "dreamer", "erase", "eraser"};
        for(int i = 0; i < 4; i++) {
        	StringBuffer d = new StringBuffer(divide[i]);
        	divide[i] = d.reverse().toString();
        }
        
        boolean can = true;
        for(int i = 0; i < S.length();) {
        	boolean flag = false;
        	for(int j = 0; j < 4; j++) {
        		String d = divide[j];
        		if(i+d.length() <= S.length() && S.substring(i, i+d.length()).equals(d)) {
        			flag = true;
        			i += d.length();
        		}
        	}
        	if(!flag) {
        		can = false;
        		break;
        	}
        }
        if(can) System.out.println("YES");
        else System.out.println("NO");

	} main {
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.next();
		StringBuffer str = new StringBuffer(S);
        S = str.reverse().toString();
        
        String[] divide = {"dream", "dreamer", "erase", "eraser"};
        for(int i = 0; i < 4; i++) {
        	StringBuffer d = new StringBuffer(divide[i]);
        	divide[i] = d.reverse().toString();
        }
        
        boolean can = true;
        for(int i = 0; i < S.length();) {
        	boolean flag = false;
        	for(int j = 0; j < 4; j++) {
        		String d = divide[j];
        		if(i+d.length() <= S.length() && S.substring(i, i+d.length()).equals(d)) {
        			flag = true;
        			i += d.length();
        		}
        	}
        	if(!flag) {
        		can = false;
        		break;
        	}
        }
        if(can) System.out.println("YES");
        else System.out.println("NO");

	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) String S = stdIn.next(); S stdIn.next() stdIn.next stdIn StringBuffer str = new StringBuffer(S); str new StringBuffer(S) S = str.reverse().toString() S str.reverse().toString() str.reverse().toString str.reverse() str.reverse str String[] divide = {"dream", "dreamer", "erase", "eraser"}; divide {"dream", "dreamer", "erase", "eraser"} "dream" "dreamer" "erase" "eraser" for(int i = 0; i < 4; i++) {
        	StringBuffer d = new StringBuffer(divide[i]);
        	divide[i] = d.reverse().toString();
        } int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
        	StringBuffer d = new StringBuffer(divide[i]);
        	divide[i] = d.reverse().toString();
        } {
        	StringBuffer d = new StringBuffer(divide[i]);
        	divide[i] = d.reverse().toString();
        } StringBuffer d = new StringBuffer(divide[i]); d new StringBuffer(divide[i]) divide[i] = d.reverse().toString() divide[i] divide i d.reverse().toString() d.reverse().toString d.reverse() d.reverse d boolean can = true; can true for(int i = 0; i < S.length();) {
        	boolean flag = false;
        	for(int j = 0; j < 4; j++) {
        		String d = divide[j];
        		if(i+d.length() <= S.length() && S.substring(i, i+d.length()).equals(d)) {
        			flag = true;
        			i += d.length();
        		}
        	}
        	if(!flag) {
        		can = false;
        		break;
        	}
        } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S {
        	boolean flag = false;
        	for(int j = 0; j < 4; j++) {
        		String d = divide[j];
        		if(i+d.length() <= S.length() && S.substring(i, i+d.length()).equals(d)) {
        			flag = true;
        			i += d.length();
        		}
        	}
        	if(!flag) {
        		can = false;
        		break;
        	}
        } {
        	boolean flag = false;
        	for(int j = 0; j < 4; j++) {
        		String d = divide[j];
        		if(i+d.length() <= S.length() && S.substring(i, i+d.length()).equals(d)) {
        			flag = true;
        			i += d.length();
        		}
        	}
        	if(!flag) {
        		can = false;
        		break;
        	}
        } boolean flag = false; flag false for(int j = 0; j < 4; j++) {
        		String d = divide[j];
        		if(i+d.length() <= S.length() && S.substring(i, i+d.length()).equals(d)) {
        			flag = true;
        			i += d.length();
        		}
        	} int j = 0; int j = 0; j 0 j < 4 j 4 j++ j++ j {
        		String d = divide[j];
        		if(i+d.length() <= S.length() && S.substring(i, i+d.length()).equals(d)) {
        			flag = true;
        			i += d.length();
        		}
        	} {
        		String d = divide[j];
        		if(i+d.length() <= S.length() && S.substring(i, i+d.length()).equals(d)) {
        			flag = true;
        			i += d.length();
        		}
        	} String d = divide[j]; d divide[j] divide j if(i+d.length() <= S.length() && S.substring(i, i+d.length()).equals(d)) {
        			flag = true;
        			i += d.length();
        		} i+d.length() <= S.length() && S.substring(i, i+d.length()).equals(d) i+d.length() <= S.length() i+d.length() i d.length() d.length d S.length() S.length S S.substring(i, i+d.length()).equals(d) S.substring(i, i+d.length()).equals S.substring(i, i+d.length()) S.substring S i i+d.length() i d.length() d.length d d {
        			flag = true;
        			i += d.length();
        		} flag = true flag true i += d.length() i d.length() d.length d if(!flag) {
        		can = false;
        		break;
        	} !flag flag {
        		can = false;
        		break;
        	} can = false can false break; if(can) System.out.println("YES");
        else System.out.println("NO"); can System.out.println("YES") System.out.println System.out System System.out "YES" System.out.println("NO") System.out.println System.out System System.out "NO" String[] args args public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.next();
		StringBuffer str = new StringBuffer(S);
        S = str.reverse().toString();
        
        String[] divide = {"dream", "dreamer", "erase", "eraser"};
        for(int i = 0; i < 4; i++) {
        	StringBuffer d = new StringBuffer(divide[i]);
        	divide[i] = d.reverse().toString();
        }
        
        boolean can = true;
        for(int i = 0; i < S.length();) {
        	boolean flag = false;
        	for(int j = 0; j < 4; j++) {
        		String d = divide[j];
        		if(i+d.length() <= S.length() && S.substring(i, i+d.length()).equals(d)) {
        			flag = true;
        			i += d.length();
        		}
        	}
        	if(!flag) {
        		can = false;
        		break;
        	}
        }
        if(can) System.out.println("YES");
        else System.out.println("NO");

	}

} public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.next();
		StringBuffer str = new StringBuffer(S);
        S = str.reverse().toString();
        
        String[] divide = {"dream", "dreamer", "erase", "eraser"};
        for(int i = 0; i < 4; i++) {
        	StringBuffer d = new StringBuffer(divide[i]);
        	divide[i] = d.reverse().toString();
        }
        
        boolean can = true;
        for(int i = 0; i < S.length();) {
        	boolean flag = false;
        	for(int j = 0; j < 4; j++) {
        		String d = divide[j];
        		if(i+d.length() <= S.length() && S.substring(i, i+d.length()).equals(d)) {
        			flag = true;
        			i += d.length();
        		}
        	}
        	if(!flag) {
        		can = false;
        		break;
        	}
        }
        if(can) System.out.println("YES");
        else System.out.println("NO");

	}

} Main
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.next();
		StringBuffer str = new StringBuffer(S);
        S = str.reverse().toString();
        
        String[] divide = {"dream", "dreamer", "erase", "eraser"};
        for(int i = 0; i < 4; i++) {
        	StringBuffer d = new StringBuffer(divide[i]);
        	divide[i] = d.reverse().toString();
        }
        
        boolean can = true;
        for(int i = 0; i < S.length();) {
        	boolean flag = false;
        	for(int j = 0; j < 4; j++) {
        		String d = divide[j];
        		if(i+d.length() <= S.length() && S.substring(i, i+d.length()).equals(d)) {
        			flag = true;
        			i += d.length();
        		}
        	}
        	if(!flag) {
        		can = false;
        		break;
        	}
        }
        if(can) System.out.println("YES");
        else System.out.println("NO");

	}

}