import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	//入力文字列反転
	String S = scan.next();
	StringBuffer sb = new StringBuffer(S);
	String S_r = sb.reverse().toString();

	//比較文字列反転
	String[] d_ = {"dream", "erase", "eraser", "dreamer"};
	String[] dr_ = new String[d_.length];
	for(int i = 0; i < d_.length; i++){
	    StringBuffer db = new StringBuffer(d_[i]);
	    dr_[i] = db.reverse().toString();
	}

	int bool = 1;
	for(int i = 0; i < S_r.length();){
	    int flag = -1;
	    for(int j = 0; j < dr_.length; j++){
		if(S_r.substring(i, i+dr_[j].length()).compareTo(dr_[j]) == 0){
		    i += dr_[j].length();
		    flag = 1;
		    break;
		}
	    }
	    if(flag == -1){
		bool = -1;
		break;
	    }
	}

	if(bool == 1){
	    System.out.println("YES");
	}else{
	    System.out.println("NO");
	}
    }
}
		 import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	//入力文字列反転
	String S = scan.next();
	StringBuffer sb = new StringBuffer(S);
	String S_r = sb.reverse().toString();

	//比較文字列反転
	String[] d_ = {"dream", "erase", "eraser", "dreamer"};
	String[] dr_ = new String[d_.length];
	for(int i = 0; i < d_.length; i++){
	    StringBuffer db = new StringBuffer(d_[i]);
	    dr_[i] = db.reverse().toString();
	}

	int bool = 1;
	for(int i = 0; i < S_r.length();){
	    int flag = -1;
	    for(int j = 0; j < dr_.length; j++){
		if(S_r.substring(i, i+dr_[j].length()).compareTo(dr_[j]) == 0){
		    i += dr_[j].length();
		    flag = 1;
		    break;
		}
	    }
	    if(flag == -1){
		bool = -1;
		break;
	    }
	}

	if(bool == 1){
	    System.out.println("YES");
	}else{
	    System.out.println("NO");
	}
    }
} Main public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	//入力文字列反転
	String S = scan.next();
	StringBuffer sb = new StringBuffer(S);
	String S_r = sb.reverse().toString();

	//比較文字列反転
	String[] d_ = {"dream", "erase", "eraser", "dreamer"};
	String[] dr_ = new String[d_.length];
	for(int i = 0; i < d_.length; i++){
	    StringBuffer db = new StringBuffer(d_[i]);
	    dr_[i] = db.reverse().toString();
	}

	int bool = 1;
	for(int i = 0; i < S_r.length();){
	    int flag = -1;
	    for(int j = 0; j < dr_.length; j++){
		if(S_r.substring(i, i+dr_[j].length()).compareTo(dr_[j]) == 0){
		    i += dr_[j].length();
		    flag = 1;
		    break;
		}
	    }
	    if(flag == -1){
		bool = -1;
		break;
	    }
	}

	if(bool == 1){
	    System.out.println("YES");
	}else{
	    System.out.println("NO");
	}
    } main {
	Scanner scan = new Scanner(System.in);

	//入力文字列反転
	String S = scan.next();
	StringBuffer sb = new StringBuffer(S);
	String S_r = sb.reverse().toString();

	//比較文字列反転
	String[] d_ = {"dream", "erase", "eraser", "dreamer"};
	String[] dr_ = new String[d_.length];
	for(int i = 0; i < d_.length; i++){
	    StringBuffer db = new StringBuffer(d_[i]);
	    dr_[i] = db.reverse().toString();
	}

	int bool = 1;
	for(int i = 0; i < S_r.length();){
	    int flag = -1;
	    for(int j = 0; j < dr_.length; j++){
		if(S_r.substring(i, i+dr_[j].length()).compareTo(dr_[j]) == 0){
		    i += dr_[j].length();
		    flag = 1;
		    break;
		}
	    }
	    if(flag == -1){
		bool = -1;
		break;
	    }
	}

	if(bool == 1){
	    System.out.println("YES");
	}else{
	    System.out.println("NO");
	}
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String S = scan.next(); S scan.next() scan.next scan StringBuffer sb = new StringBuffer(S); sb new StringBuffer(S) String S_r = sb.reverse().toString(); S_r sb.reverse().toString() sb.reverse().toString sb.reverse() sb.reverse sb String[] d_ = {"dream", "erase", "eraser", "dreamer"}; d_ {"dream", "erase", "eraser", "dreamer"} "dream" "erase" "eraser" "dreamer" String[] dr_ = new String[d_.length]; dr_ new String[d_.length] d_.length d_ d_.length for(int i = 0; i < d_.length; i++){
	    StringBuffer db = new StringBuffer(d_[i]);
	    dr_[i] = db.reverse().toString();
	} int i = 0; int i = 0; i 0 i < d_.length i d_.length d_ d_.length i++ i++ i {
	    StringBuffer db = new StringBuffer(d_[i]);
	    dr_[i] = db.reverse().toString();
	} {
	    StringBuffer db = new StringBuffer(d_[i]);
	    dr_[i] = db.reverse().toString();
	} StringBuffer db = new StringBuffer(d_[i]); db new StringBuffer(d_[i]) dr_[i] = db.reverse().toString() dr_[i] dr_ i db.reverse().toString() db.reverse().toString db.reverse() db.reverse db int bool = 1; bool 1 for(int i = 0; i < S_r.length();){
	    int flag = -1;
	    for(int j = 0; j < dr_.length; j++){
		if(S_r.substring(i, i+dr_[j].length()).compareTo(dr_[j]) == 0){
		    i += dr_[j].length();
		    flag = 1;
		    break;
		}
	    }
	    if(flag == -1){
		bool = -1;
		break;
	    }
	} int i = 0; int i = 0; i 0 i < S_r.length() i S_r.length() S_r.length S_r {
	    int flag = -1;
	    for(int j = 0; j < dr_.length; j++){
		if(S_r.substring(i, i+dr_[j].length()).compareTo(dr_[j]) == 0){
		    i += dr_[j].length();
		    flag = 1;
		    break;
		}
	    }
	    if(flag == -1){
		bool = -1;
		break;
	    }
	} {
	    int flag = -1;
	    for(int j = 0; j < dr_.length; j++){
		if(S_r.substring(i, i+dr_[j].length()).compareTo(dr_[j]) == 0){
		    i += dr_[j].length();
		    flag = 1;
		    break;
		}
	    }
	    if(flag == -1){
		bool = -1;
		break;
	    }
	} int flag = -1; flag -1 1 for(int j = 0; j < dr_.length; j++){
		if(S_r.substring(i, i+dr_[j].length()).compareTo(dr_[j]) == 0){
		    i += dr_[j].length();
		    flag = 1;
		    break;
		}
	    } int j = 0; int j = 0; j 0 j < dr_.length j dr_.length dr_ dr_.length j++ j++ j {
		if(S_r.substring(i, i+dr_[j].length()).compareTo(dr_[j]) == 0){
		    i += dr_[j].length();
		    flag = 1;
		    break;
		}
	    } {
		if(S_r.substring(i, i+dr_[j].length()).compareTo(dr_[j]) == 0){
		    i += dr_[j].length();
		    flag = 1;
		    break;
		}
	    } if(S_r.substring(i, i+dr_[j].length()).compareTo(dr_[j]) == 0){
		    i += dr_[j].length();
		    flag = 1;
		    break;
		} S_r.substring(i, i+dr_[j].length()).compareTo(dr_[j]) == 0 S_r.substring(i, i+dr_[j].length()).compareTo(dr_[j]) S_r.substring(i, i+dr_[j].length()).compareTo S_r.substring(i, i+dr_[j].length()) S_r.substring S_r i i+dr_[j].length() i dr_[j].length() dr_[j].length dr_[j] dr_ j dr_[j] dr_ j 0 {
		    i += dr_[j].length();
		    flag = 1;
		    break;
		} i += dr_[j].length() i dr_[j].length() dr_[j].length dr_[j] dr_ j flag = 1 flag 1 break; if(flag == -1){
		bool = -1;
		break;
	    } flag == -1 flag -1 1 {
		bool = -1;
		break;
	    } bool = -1 bool -1 1 break; if(bool == 1){
	    System.out.println("YES");
	}else{
	    System.out.println("NO");
	} bool == 1 bool 1 {
	    System.out.println("YES");
	} System.out.println("YES") System.out.println System.out System System.out "YES" {
	    System.out.println("NO");
	} 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 scan = new Scanner(System.in);

	//入力文字列反転
	String S = scan.next();
	StringBuffer sb = new StringBuffer(S);
	String S_r = sb.reverse().toString();

	//比較文字列反転
	String[] d_ = {"dream", "erase", "eraser", "dreamer"};
	String[] dr_ = new String[d_.length];
	for(int i = 0; i < d_.length; i++){
	    StringBuffer db = new StringBuffer(d_[i]);
	    dr_[i] = db.reverse().toString();
	}

	int bool = 1;
	for(int i = 0; i < S_r.length();){
	    int flag = -1;
	    for(int j = 0; j < dr_.length; j++){
		if(S_r.substring(i, i+dr_[j].length()).compareTo(dr_[j]) == 0){
		    i += dr_[j].length();
		    flag = 1;
		    break;
		}
	    }
	    if(flag == -1){
		bool = -1;
		break;
	    }
	}

	if(bool == 1){
	    System.out.println("YES");
	}else{
	    System.out.println("NO");
	}
    }
} public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	//入力文字列反転
	String S = scan.next();
	StringBuffer sb = new StringBuffer(S);
	String S_r = sb.reverse().toString();

	//比較文字列反転
	String[] d_ = {"dream", "erase", "eraser", "dreamer"};
	String[] dr_ = new String[d_.length];
	for(int i = 0; i < d_.length; i++){
	    StringBuffer db = new StringBuffer(d_[i]);
	    dr_[i] = db.reverse().toString();
	}

	int bool = 1;
	for(int i = 0; i < S_r.length();){
	    int flag = -1;
	    for(int j = 0; j < dr_.length; j++){
		if(S_r.substring(i, i+dr_[j].length()).compareTo(dr_[j]) == 0){
		    i += dr_[j].length();
		    flag = 1;
		    break;
		}
	    }
	    if(flag == -1){
		bool = -1;
		break;
	    }
	}

	if(bool == 1){
	    System.out.println("YES");
	}else{
	    System.out.println("NO");
	}
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	//入力文字列反転
	String S = scan.next();
	StringBuffer sb = new StringBuffer(S);
	String S_r = sb.reverse().toString();

	//比較文字列反転
	String[] d_ = {"dream", "erase", "eraser", "dreamer"};
	String[] dr_ = new String[d_.length];
	for(int i = 0; i < d_.length; i++){
	    StringBuffer db = new StringBuffer(d_[i]);
	    dr_[i] = db.reverse().toString();
	}

	int bool = 1;
	for(int i = 0; i < S_r.length();){
	    int flag = -1;
	    for(int j = 0; j < dr_.length; j++){
		if(S_r.substring(i, i+dr_[j].length()).compareTo(dr_[j]) == 0){
		    i += dr_[j].length();
		    flag = 1;
		    break;
		}
	    }
	    if(flag == -1){
		bool = -1;
		break;
	    }
	}

	if(bool == 1){
	    System.out.println("YES");
	}else{
	    System.out.println("NO");
	}
    }
}
		
