import java.io.*;

public class Main {

	final static long MOD = 1000000007;
	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String S = in.readLine();
		String T ="";
		String[] A = {"dream","dreamer","erase","eraser"};
		String[] B = {"eam","mer","ase","ser"};
		int i = S.length();
		String sfx="";
		String ans = "YES";
		boolean flg=true;
		while(flg){
			sfx=S.substring(i-3,i);
			for(int x=0;x<B.length;x++){
				if(sfx.equals(B[x])){
					if(A[x].equals(S.substring(i-A[x].length(),i))){
						i=i-A[x].length();
						sfx=null;
						break;
					}else{
						ans="NO";
						flg=false;
						break;
					}
				}
			}
			if(sfx!=null){
				ans="NO";
				break;
			}
			if(i==0){
				break;
			}
			if(i-3<0){
				ans="NO";
				break;
			}
		}

		System.out.println(ans);
	}
} import java.io.*; io.* java public class Main {

	final static long MOD = 1000000007;
	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String S = in.readLine();
		String T ="";
		String[] A = {"dream","dreamer","erase","eraser"};
		String[] B = {"eam","mer","ase","ser"};
		int i = S.length();
		String sfx="";
		String ans = "YES";
		boolean flg=true;
		while(flg){
			sfx=S.substring(i-3,i);
			for(int x=0;x<B.length;x++){
				if(sfx.equals(B[x])){
					if(A[x].equals(S.substring(i-A[x].length(),i))){
						i=i-A[x].length();
						sfx=null;
						break;
					}else{
						ans="NO";
						flg=false;
						break;
					}
				}
			}
			if(sfx!=null){
				ans="NO";
				break;
			}
			if(i==0){
				break;
			}
			if(i-3<0){
				ans="NO";
				break;
			}
		}

		System.out.println(ans);
	}
} Main final static long MOD = 1000000007; MOD 1000000007 public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String S = in.readLine();
		String T ="";
		String[] A = {"dream","dreamer","erase","eraser"};
		String[] B = {"eam","mer","ase","ser"};
		int i = S.length();
		String sfx="";
		String ans = "YES";
		boolean flg=true;
		while(flg){
			sfx=S.substring(i-3,i);
			for(int x=0;x<B.length;x++){
				if(sfx.equals(B[x])){
					if(A[x].equals(S.substring(i-A[x].length(),i))){
						i=i-A[x].length();
						sfx=null;
						break;
					}else{
						ans="NO";
						flg=false;
						break;
					}
				}
			}
			if(sfx!=null){
				ans="NO";
				break;
			}
			if(i==0){
				break;
			}
			if(i-3<0){
				ans="NO";
				break;
			}
		}

		System.out.println(ans);
	} main {
		// TODO 自動生成されたメソッド・スタブ

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String S = in.readLine();
		String T ="";
		String[] A = {"dream","dreamer","erase","eraser"};
		String[] B = {"eam","mer","ase","ser"};
		int i = S.length();
		String sfx="";
		String ans = "YES";
		boolean flg=true;
		while(flg){
			sfx=S.substring(i-3,i);
			for(int x=0;x<B.length;x++){
				if(sfx.equals(B[x])){
					if(A[x].equals(S.substring(i-A[x].length(),i))){
						i=i-A[x].length();
						sfx=null;
						break;
					}else{
						ans="NO";
						flg=false;
						break;
					}
				}
			}
			if(sfx!=null){
				ans="NO";
				break;
			}
			if(i==0){
				break;
			}
			if(i-3<0){
				ans="NO";
				break;
			}
		}

		System.out.println(ans);
	} BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) String S = in.readLine(); S in.readLine() in.readLine in String T =""; T "" String[] A = {"dream","dreamer","erase","eraser"}; A {"dream","dreamer","erase","eraser"} "dream" "dreamer" "erase" "eraser" String[] B = {"eam","mer","ase","ser"}; B {"eam","mer","ase","ser"} "eam" "mer" "ase" "ser" int i = S.length(); i S.length() S.length S String sfx=""; sfx "" String ans = "YES"; ans "YES" boolean flg=true; flg true while(flg){
			sfx=S.substring(i-3,i);
			for(int x=0;x<B.length;x++){
				if(sfx.equals(B[x])){
					if(A[x].equals(S.substring(i-A[x].length(),i))){
						i=i-A[x].length();
						sfx=null;
						break;
					}else{
						ans="NO";
						flg=false;
						break;
					}
				}
			}
			if(sfx!=null){
				ans="NO";
				break;
			}
			if(i==0){
				break;
			}
			if(i-3<0){
				ans="NO";
				break;
			}
		} flg {
			sfx=S.substring(i-3,i);
			for(int x=0;x<B.length;x++){
				if(sfx.equals(B[x])){
					if(A[x].equals(S.substring(i-A[x].length(),i))){
						i=i-A[x].length();
						sfx=null;
						break;
					}else{
						ans="NO";
						flg=false;
						break;
					}
				}
			}
			if(sfx!=null){
				ans="NO";
				break;
			}
			if(i==0){
				break;
			}
			if(i-3<0){
				ans="NO";
				break;
			}
		} sfx=S.substring(i-3,i) sfx S.substring(i-3,i) S.substring S i-3 i 3 i for(int x=0;x<B.length;x++){
				if(sfx.equals(B[x])){
					if(A[x].equals(S.substring(i-A[x].length(),i))){
						i=i-A[x].length();
						sfx=null;
						break;
					}else{
						ans="NO";
						flg=false;
						break;
					}
				}
			} int x=0; int x=0; x 0 x<B.length x B.length B B.length x++ x++ x {
				if(sfx.equals(B[x])){
					if(A[x].equals(S.substring(i-A[x].length(),i))){
						i=i-A[x].length();
						sfx=null;
						break;
					}else{
						ans="NO";
						flg=false;
						break;
					}
				}
			} {
				if(sfx.equals(B[x])){
					if(A[x].equals(S.substring(i-A[x].length(),i))){
						i=i-A[x].length();
						sfx=null;
						break;
					}else{
						ans="NO";
						flg=false;
						break;
					}
				}
			} if(sfx.equals(B[x])){
					if(A[x].equals(S.substring(i-A[x].length(),i))){
						i=i-A[x].length();
						sfx=null;
						break;
					}else{
						ans="NO";
						flg=false;
						break;
					}
				} sfx.equals(B[x]) sfx.equals sfx B[x] B x {
					if(A[x].equals(S.substring(i-A[x].length(),i))){
						i=i-A[x].length();
						sfx=null;
						break;
					}else{
						ans="NO";
						flg=false;
						break;
					}
				} if(A[x].equals(S.substring(i-A[x].length(),i))){
						i=i-A[x].length();
						sfx=null;
						break;
					}else{
						ans="NO";
						flg=false;
						break;
					} A[x].equals(S.substring(i-A[x].length(),i)) A[x].equals A[x] A x S.substring(i-A[x].length(),i) S.substring S i-A[x].length() i A[x].length() A[x].length A[x] A x i {
						i=i-A[x].length();
						sfx=null;
						break;
					} i=i-A[x].length() i i-A[x].length() i A[x].length() A[x].length A[x] A x sfx=null sfx null break; {
						ans="NO";
						flg=false;
						break;
					} ans="NO" ans "NO" flg=false flg false break; if(sfx!=null){
				ans="NO";
				break;
			} sfx!=null sfx null {
				ans="NO";
				break;
			} ans="NO" ans "NO" break; if(i==0){
				break;
			} i==0 i 0 {
				break;
			} break; if(i-3<0){
				ans="NO";
				break;
			} i-3<0 i-3 i 3 0 {
				ans="NO";
				break;
			} ans="NO" ans "NO" break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	final static long MOD = 1000000007;
	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String S = in.readLine();
		String T ="";
		String[] A = {"dream","dreamer","erase","eraser"};
		String[] B = {"eam","mer","ase","ser"};
		int i = S.length();
		String sfx="";
		String ans = "YES";
		boolean flg=true;
		while(flg){
			sfx=S.substring(i-3,i);
			for(int x=0;x<B.length;x++){
				if(sfx.equals(B[x])){
					if(A[x].equals(S.substring(i-A[x].length(),i))){
						i=i-A[x].length();
						sfx=null;
						break;
					}else{
						ans="NO";
						flg=false;
						break;
					}
				}
			}
			if(sfx!=null){
				ans="NO";
				break;
			}
			if(i==0){
				break;
			}
			if(i-3<0){
				ans="NO";
				break;
			}
		}

		System.out.println(ans);
	}
} public class Main {

	final static long MOD = 1000000007;
	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String S = in.readLine();
		String T ="";
		String[] A = {"dream","dreamer","erase","eraser"};
		String[] B = {"eam","mer","ase","ser"};
		int i = S.length();
		String sfx="";
		String ans = "YES";
		boolean flg=true;
		while(flg){
			sfx=S.substring(i-3,i);
			for(int x=0;x<B.length;x++){
				if(sfx.equals(B[x])){
					if(A[x].equals(S.substring(i-A[x].length(),i))){
						i=i-A[x].length();
						sfx=null;
						break;
					}else{
						ans="NO";
						flg=false;
						break;
					}
				}
			}
			if(sfx!=null){
				ans="NO";
				break;
			}
			if(i==0){
				break;
			}
			if(i-3<0){
				ans="NO";
				break;
			}
		}

		System.out.println(ans);
	}
} Main
import java.io.*;

public class Main {

	final static long MOD = 1000000007;
	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String S = in.readLine();
		String T ="";
		String[] A = {"dream","dreamer","erase","eraser"};
		String[] B = {"eam","mer","ase","ser"};
		int i = S.length();
		String sfx="";
		String ans = "YES";
		boolean flg=true;
		while(flg){
			sfx=S.substring(i-3,i);
			for(int x=0;x<B.length;x++){
				if(sfx.equals(B[x])){
					if(A[x].equals(S.substring(i-A[x].length(),i))){
						i=i-A[x].length();
						sfx=null;
						break;
					}else{
						ans="NO";
						flg=false;
						break;
					}
				}
			}
			if(sfx!=null){
				ans="NO";
				break;
			}
			if(i==0){
				break;
			}
			if(i-3<0){
				ans="NO";
				break;
			}
		}

		System.out.println(ans);
	}
}
