import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
    
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();

		// 計算
		String result = "NO";
		int len = s.length();
		while(len >= 0){
		    if(len == 0){
		        result = "YES";
		        break;
		    }
    	    if(len >= 5 && "dream".equals(s.substring(len - 5, len))){len -= 5; continue;}
    	    if(len >= 5 && "erase".equals(s.substring(len - 5, len))){len -= 5; continue;}
    	    if(len >= 6 && "eraser".equals(s.substring(len - 6, len))){len -= 6; continue;}
    	    if(len >= 7 && "dreamer".equals(s.substring(len - 7, len))){len -= 7; continue;}
    	    len = -1;
		}
		
		// 出力
		System.out.println(result);
        
	}
} import java.util.*; util.* java import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; import java.math.BigInteger; BigInteger java.math public class Main {
    
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();

		// 計算
		String result = "NO";
		int len = s.length();
		while(len >= 0){
		    if(len == 0){
		        result = "YES";
		        break;
		    }
    	    if(len >= 5 && "dream".equals(s.substring(len - 5, len))){len -= 5; continue;}
    	    if(len >= 5 && "erase".equals(s.substring(len - 5, len))){len -= 5; continue;}
    	    if(len >= 6 && "eraser".equals(s.substring(len - 6, len))){len -= 6; continue;}
    	    if(len >= 7 && "dreamer".equals(s.substring(len - 7, len))){len -= 7; continue;}
    	    len = -1;
		}
		
		// 出力
		System.out.println(result);
        
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();

		// 計算
		String result = "NO";
		int len = s.length();
		while(len >= 0){
		    if(len == 0){
		        result = "YES";
		        break;
		    }
    	    if(len >= 5 && "dream".equals(s.substring(len - 5, len))){len -= 5; continue;}
    	    if(len >= 5 && "erase".equals(s.substring(len - 5, len))){len -= 5; continue;}
    	    if(len >= 6 && "eraser".equals(s.substring(len - 6, len))){len -= 6; continue;}
    	    if(len >= 7 && "dreamer".equals(s.substring(len - 7, len))){len -= 7; continue;}
    	    len = -1;
		}
		
		// 出力
		System.out.println(result);
        
	} main {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();

		// 計算
		String result = "NO";
		int len = s.length();
		while(len >= 0){
		    if(len == 0){
		        result = "YES";
		        break;
		    }
    	    if(len >= 5 && "dream".equals(s.substring(len - 5, len))){len -= 5; continue;}
    	    if(len >= 5 && "erase".equals(s.substring(len - 5, len))){len -= 5; continue;}
    	    if(len >= 6 && "eraser".equals(s.substring(len - 6, len))){len -= 6; continue;}
    	    if(len >= 7 && "dreamer".equals(s.substring(len - 7, len))){len -= 7; continue;}
    	    len = -1;
		}
		
		// 出力
		System.out.println(result);
        
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String result = "NO"; result "NO" int len = s.length(); len s.length() s.length s while(len >= 0){
		    if(len == 0){
		        result = "YES";
		        break;
		    }
    	    if(len >= 5 && "dream".equals(s.substring(len - 5, len))){len -= 5; continue;}
    	    if(len >= 5 && "erase".equals(s.substring(len - 5, len))){len -= 5; continue;}
    	    if(len >= 6 && "eraser".equals(s.substring(len - 6, len))){len -= 6; continue;}
    	    if(len >= 7 && "dreamer".equals(s.substring(len - 7, len))){len -= 7; continue;}
    	    len = -1;
		} len >= 0 len 0 {
		    if(len == 0){
		        result = "YES";
		        break;
		    }
    	    if(len >= 5 && "dream".equals(s.substring(len - 5, len))){len -= 5; continue;}
    	    if(len >= 5 && "erase".equals(s.substring(len - 5, len))){len -= 5; continue;}
    	    if(len >= 6 && "eraser".equals(s.substring(len - 6, len))){len -= 6; continue;}
    	    if(len >= 7 && "dreamer".equals(s.substring(len - 7, len))){len -= 7; continue;}
    	    len = -1;
		} if(len == 0){
		        result = "YES";
		        break;
		    } len == 0 len 0 {
		        result = "YES";
		        break;
		    } result = "YES" result "YES" break; if(len >= 5 && "dream".equals(s.substring(len - 5, len))){len -= 5; continue;} len >= 5 && "dream".equals(s.substring(len - 5, len)) len >= 5 len 5 "dream".equals(s.substring(len - 5, len)) "dream".equals "dream" s.substring(len - 5, len) s.substring s len - 5 len 5 len {len -= 5; continue;} len -= 5 len 5 continue; if(len >= 5 && "erase".equals(s.substring(len - 5, len))){len -= 5; continue;} len >= 5 && "erase".equals(s.substring(len - 5, len)) len >= 5 len 5 "erase".equals(s.substring(len - 5, len)) "erase".equals "erase" s.substring(len - 5, len) s.substring s len - 5 len 5 len {len -= 5; continue;} len -= 5 len 5 continue; if(len >= 6 && "eraser".equals(s.substring(len - 6, len))){len -= 6; continue;} len >= 6 && "eraser".equals(s.substring(len - 6, len)) len >= 6 len 6 "eraser".equals(s.substring(len - 6, len)) "eraser".equals "eraser" s.substring(len - 6, len) s.substring s len - 6 len 6 len {len -= 6; continue;} len -= 6 len 6 continue; if(len >= 7 && "dreamer".equals(s.substring(len - 7, len))){len -= 7; continue;} len >= 7 && "dreamer".equals(s.substring(len - 7, len)) len >= 7 len 7 "dreamer".equals(s.substring(len - 7, len)) "dreamer".equals "dreamer" s.substring(len - 7, len) s.substring s len - 7 len 7 len {len -= 7; continue;} len -= 7 len 7 continue; len = -1 len -1 1 System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
    
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();

		// 計算
		String result = "NO";
		int len = s.length();
		while(len >= 0){
		    if(len == 0){
		        result = "YES";
		        break;
		    }
    	    if(len >= 5 && "dream".equals(s.substring(len - 5, len))){len -= 5; continue;}
    	    if(len >= 5 && "erase".equals(s.substring(len - 5, len))){len -= 5; continue;}
    	    if(len >= 6 && "eraser".equals(s.substring(len - 6, len))){len -= 6; continue;}
    	    if(len >= 7 && "dreamer".equals(s.substring(len - 7, len))){len -= 7; continue;}
    	    len = -1;
		}
		
		// 出力
		System.out.println(result);
        
	}
} public class Main {
    
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();

		// 計算
		String result = "NO";
		int len = s.length();
		while(len >= 0){
		    if(len == 0){
		        result = "YES";
		        break;
		    }
    	    if(len >= 5 && "dream".equals(s.substring(len - 5, len))){len -= 5; continue;}
    	    if(len >= 5 && "erase".equals(s.substring(len - 5, len))){len -= 5; continue;}
    	    if(len >= 6 && "eraser".equals(s.substring(len - 6, len))){len -= 6; continue;}
    	    if(len >= 7 && "dreamer".equals(s.substring(len - 7, len))){len -= 7; continue;}
    	    len = -1;
		}
		
		// 出力
		System.out.println(result);
        
	}
} Main
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
    
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();

		// 計算
		String result = "NO";
		int len = s.length();
		while(len >= 0){
		    if(len == 0){
		        result = "YES";
		        break;
		    }
    	    if(len >= 5 && "dream".equals(s.substring(len - 5, len))){len -= 5; continue;}
    	    if(len >= 5 && "erase".equals(s.substring(len - 5, len))){len -= 5; continue;}
    	    if(len >= 6 && "eraser".equals(s.substring(len - 6, len))){len -= 6; continue;}
    	    if(len >= 7 && "dreamer".equals(s.substring(len - 7, len))){len -= 7; continue;}
    	    len = -1;
		}
		
		// 出力
		System.out.println(result);
        
	}
}
