import java.io.File;
import java.io.FileInputStream;
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;

public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		String[] list = {"eraser", "erase", "dreamer", "dream"};
		for(String m : list){
			while(true){
				int index = S.indexOf(m);
				if(index == -1) break;
				S = S.replace(m, "");
			}
		}
		
		System.out.println(S.equals("") ? "YES" : "NO");
	}
} import java.io.File; File java.io import java.io.FileInputStream; FileInputStream java.io import java.util.NoSuchElementException; NoSuchElementException java.util import java.util.Scanner; Scanner java.util import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.util.ArrayDeque; ArrayDeque java.util import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.Comparator; Comparator java.util import java.util.Deque; Deque java.util import java.util.HashMap; HashMap java.util import java.util.List; List java.util import java.util.Map.Entry; Entry java.util.Map public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		String[] list = {"eraser", "erase", "dreamer", "dream"};
		for(String m : list){
			while(true){
				int index = S.indexOf(m);
				if(index == -1) break;
				S = S.replace(m, "");
			}
		}
		
		System.out.println(S.equals("") ? "YES" : "NO");
	}
} Main public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		String[] list = {"eraser", "erase", "dreamer", "dream"};
		for(String m : list){
			while(true){
				int index = S.indexOf(m);
				if(index == -1) break;
				S = S.replace(m, "");
			}
		}
		
		System.out.println(S.equals("") ? "YES" : "NO");
	} main {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		String[] list = {"eraser", "erase", "dreamer", "dream"};
		for(String m : list){
			while(true){
				int index = S.indexOf(m);
				if(index == -1) break;
				S = S.replace(m, "");
			}
		}
		
		System.out.println(S.equals("") ? "YES" : "NO");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String[] list = {"eraser", "erase", "dreamer", "dream"}; list {"eraser", "erase", "dreamer", "dream"} "eraser" "erase" "dreamer" "dream" for(String m : list){
			while(true){
				int index = S.indexOf(m);
				if(index == -1) break;
				S = S.replace(m, "");
			}
		} String m list {
			while(true){
				int index = S.indexOf(m);
				if(index == -1) break;
				S = S.replace(m, "");
			}
		} {
			while(true){
				int index = S.indexOf(m);
				if(index == -1) break;
				S = S.replace(m, "");
			}
		} while(true){
				int index = S.indexOf(m);
				if(index == -1) break;
				S = S.replace(m, "");
			} true {
				int index = S.indexOf(m);
				if(index == -1) break;
				S = S.replace(m, "");
			} int index = S.indexOf(m); index S.indexOf(m) S.indexOf S m if(index == -1) break; index == -1 index -1 1 break; S = S.replace(m, "") S S.replace(m, "") S.replace S m "" System.out.println(S.equals("") ? "YES" : "NO") System.out.println System.out System System.out S.equals("") ? "YES" : "NO" S.equals("") S.equals S "" "YES" "NO" String[] args args public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		String[] list = {"eraser", "erase", "dreamer", "dream"};
		for(String m : list){
			while(true){
				int index = S.indexOf(m);
				if(index == -1) break;
				S = S.replace(m, "");
			}
		}
		
		System.out.println(S.equals("") ? "YES" : "NO");
	}
} public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		String[] list = {"eraser", "erase", "dreamer", "dream"};
		for(String m : list){
			while(true){
				int index = S.indexOf(m);
				if(index == -1) break;
				S = S.replace(m, "");
			}
		}
		
		System.out.println(S.equals("") ? "YES" : "NO");
	}
} Main
import java.io.File;
import java.io.FileInputStream;
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;

public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		String[] list = {"eraser", "erase", "dreamer", "dream"};
		for(String m : list){
			while(true){
				int index = S.indexOf(m);
				if(index == -1) break;
				S = S.replace(m, "");
			}
		}
		
		System.out.println(S.equals("") ? "YES" : "NO");
	}
}