
import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	StringBuilder str = new StringBuilder(scan.next());
	String[] key = new String[]{"dream", "dreamer", "erase", "eraser"};
	
	boolean flag = true;
	while(flag) {
	    flag = false;

	    for(int i=0; i<key.length; i++) {
		int index = str.length() - key[i].length();
		if( index > -1) {
		    if(str.substring(index).equals(key[i])) {
			str.delete(index, str.length());
			flag = true;
			break;
		    }
		}
	    }
	}
	System.out.println(str.length() == 0 ? "YES" : "NO");
	scan.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	StringBuilder str = new StringBuilder(scan.next());
	String[] key = new String[]{"dream", "dreamer", "erase", "eraser"};
	
	boolean flag = true;
	while(flag) {
	    flag = false;

	    for(int i=0; i<key.length; i++) {
		int index = str.length() - key[i].length();
		if( index > -1) {
		    if(str.substring(index).equals(key[i])) {
			str.delete(index, str.length());
			flag = true;
			break;
		    }
		}
	    }
	}
	System.out.println(str.length() == 0 ? "YES" : "NO");
	scan.close();
    }
} Main private static Scanner scan = new Scanner(System.in); scan new Scanner(System.in) public static void main(String[] args) {
	StringBuilder str = new StringBuilder(scan.next());
	String[] key = new String[]{"dream", "dreamer", "erase", "eraser"};
	
	boolean flag = true;
	while(flag) {
	    flag = false;

	    for(int i=0; i<key.length; i++) {
		int index = str.length() - key[i].length();
		if( index > -1) {
		    if(str.substring(index).equals(key[i])) {
			str.delete(index, str.length());
			flag = true;
			break;
		    }
		}
	    }
	}
	System.out.println(str.length() == 0 ? "YES" : "NO");
	scan.close();
    } main {
	StringBuilder str = new StringBuilder(scan.next());
	String[] key = new String[]{"dream", "dreamer", "erase", "eraser"};
	
	boolean flag = true;
	while(flag) {
	    flag = false;

	    for(int i=0; i<key.length; i++) {
		int index = str.length() - key[i].length();
		if( index > -1) {
		    if(str.substring(index).equals(key[i])) {
			str.delete(index, str.length());
			flag = true;
			break;
		    }
		}
	    }
	}
	System.out.println(str.length() == 0 ? "YES" : "NO");
	scan.close();
    } StringBuilder str = new StringBuilder(scan.next()); str new StringBuilder(scan.next()) String[] key = new String[]{"dream", "dreamer", "erase", "eraser"}; key new String[]{"dream", "dreamer", "erase", "eraser"} boolean flag = true; flag true while(flag) {
	    flag = false;

	    for(int i=0; i<key.length; i++) {
		int index = str.length() - key[i].length();
		if( index > -1) {
		    if(str.substring(index).equals(key[i])) {
			str.delete(index, str.length());
			flag = true;
			break;
		    }
		}
	    }
	} flag {
	    flag = false;

	    for(int i=0; i<key.length; i++) {
		int index = str.length() - key[i].length();
		if( index > -1) {
		    if(str.substring(index).equals(key[i])) {
			str.delete(index, str.length());
			flag = true;
			break;
		    }
		}
	    }
	} flag = false flag false for(int i=0; i<key.length; i++) {
		int index = str.length() - key[i].length();
		if( index > -1) {
		    if(str.substring(index).equals(key[i])) {
			str.delete(index, str.length());
			flag = true;
			break;
		    }
		}
	    } int i=0; int i=0; i 0 i<key.length i key.length key key.length i++ i++ i {
		int index = str.length() - key[i].length();
		if( index > -1) {
		    if(str.substring(index).equals(key[i])) {
			str.delete(index, str.length());
			flag = true;
			break;
		    }
		}
	    } {
		int index = str.length() - key[i].length();
		if( index > -1) {
		    if(str.substring(index).equals(key[i])) {
			str.delete(index, str.length());
			flag = true;
			break;
		    }
		}
	    } int index = str.length() - key[i].length(); index str.length() - key[i].length() str.length() str.length str key[i].length() key[i].length key[i] key i if( index > -1) {
		    if(str.substring(index).equals(key[i])) {
			str.delete(index, str.length());
			flag = true;
			break;
		    }
		} index > -1 index -1 1 {
		    if(str.substring(index).equals(key[i])) {
			str.delete(index, str.length());
			flag = true;
			break;
		    }
		} if(str.substring(index).equals(key[i])) {
			str.delete(index, str.length());
			flag = true;
			break;
		    } str.substring(index).equals(key[i]) str.substring(index).equals str.substring(index) str.substring str index key[i] key i {
			str.delete(index, str.length());
			flag = true;
			break;
		    } str.delete(index, str.length()) str.delete str index str.length() str.length str flag = true flag true break; System.out.println(str.length() == 0 ? "YES" : "NO") System.out.println System.out System System.out str.length() == 0 ? "YES" : "NO" str.length() == 0 str.length() str.length str 0 "YES" "NO" scan.close() scan.close scan String[] args args public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	StringBuilder str = new StringBuilder(scan.next());
	String[] key = new String[]{"dream", "dreamer", "erase", "eraser"};
	
	boolean flag = true;
	while(flag) {
	    flag = false;

	    for(int i=0; i<key.length; i++) {
		int index = str.length() - key[i].length();
		if( index > -1) {
		    if(str.substring(index).equals(key[i])) {
			str.delete(index, str.length());
			flag = true;
			break;
		    }
		}
	    }
	}
	System.out.println(str.length() == 0 ? "YES" : "NO");
	scan.close();
    }
} public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	StringBuilder str = new StringBuilder(scan.next());
	String[] key = new String[]{"dream", "dreamer", "erase", "eraser"};
	
	boolean flag = true;
	while(flag) {
	    flag = false;

	    for(int i=0; i<key.length; i++) {
		int index = str.length() - key[i].length();
		if( index > -1) {
		    if(str.substring(index).equals(key[i])) {
			str.delete(index, str.length());
			flag = true;
			break;
		    }
		}
	    }
	}
	System.out.println(str.length() == 0 ? "YES" : "NO");
	scan.close();
    }
} Main

import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	StringBuilder str = new StringBuilder(scan.next());
	String[] key = new String[]{"dream", "dreamer", "erase", "eraser"};
	
	boolean flag = true;
	while(flag) {
	    flag = false;

	    for(int i=0; i<key.length; i++) {
		int index = str.length() - key[i].length();
		if( index > -1) {
		    if(str.substring(index).equals(key[i])) {
			str.delete(index, str.length());
			flag = true;
			break;
		    }
		}
	    }
	}
	System.out.println(str.length() == 0 ? "YES" : "NO");
	scan.close();
    }
}
