import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] t = new String[]{"dream", "dreamer", "erase", "eraser"};
        
        int i = s.length();
        while(i > 0) {
            int j = 0;
            for(; j < t.length; j++) {
                String str = t[j];
                if(i - str.length() >= 0 && s.substring(i - str.length(), i).equals(str)) {
                    i = i - str.length();
                    break;
                }
            }
            if(j == t.length) {
                System.out.println("NO");
                return;
            }
        }
        
        System.out.println("YES");
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] t = new String[]{"dream", "dreamer", "erase", "eraser"};
        
        int i = s.length();
        while(i > 0) {
            int j = 0;
            for(; j < t.length; j++) {
                String str = t[j];
                if(i - str.length() >= 0 && s.substring(i - str.length(), i).equals(str)) {
                    i = i - str.length();
                    break;
                }
            }
            if(j == t.length) {
                System.out.println("NO");
                return;
            }
        }
        
        System.out.println("YES");
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] t = new String[]{"dream", "dreamer", "erase", "eraser"};
        
        int i = s.length();
        while(i > 0) {
            int j = 0;
            for(; j < t.length; j++) {
                String str = t[j];
                if(i - str.length() >= 0 && s.substring(i - str.length(), i).equals(str)) {
                    i = i - str.length();
                    break;
                }
            }
            if(j == t.length) {
                System.out.println("NO");
                return;
            }
        }
        
        System.out.println("YES");
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] t = new String[]{"dream", "dreamer", "erase", "eraser"};
        
        int i = s.length();
        while(i > 0) {
            int j = 0;
            for(; j < t.length; j++) {
                String str = t[j];
                if(i - str.length() >= 0 && s.substring(i - str.length(), i).equals(str)) {
                    i = i - str.length();
                    break;
                }
            }
            if(j == t.length) {
                System.out.println("NO");
                return;
            }
        }
        
        System.out.println("YES");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String[] t = new String[]{"dream", "dreamer", "erase", "eraser"}; t new String[]{"dream", "dreamer", "erase", "eraser"} int i = s.length(); i s.length() s.length s while(i > 0) {
            int j = 0;
            for(; j < t.length; j++) {
                String str = t[j];
                if(i - str.length() >= 0 && s.substring(i - str.length(), i).equals(str)) {
                    i = i - str.length();
                    break;
                }
            }
            if(j == t.length) {
                System.out.println("NO");
                return;
            }
        } i > 0 i 0 {
            int j = 0;
            for(; j < t.length; j++) {
                String str = t[j];
                if(i - str.length() >= 0 && s.substring(i - str.length(), i).equals(str)) {
                    i = i - str.length();
                    break;
                }
            }
            if(j == t.length) {
                System.out.println("NO");
                return;
            }
        } int j = 0; j 0 for(; j < t.length; j++) {
                String str = t[j];
                if(i - str.length() >= 0 && s.substring(i - str.length(), i).equals(str)) {
                    i = i - str.length();
                    break;
                }
            } ; j < t.length j t.length t t.length j++ j++ j {
                String str = t[j];
                if(i - str.length() >= 0 && s.substring(i - str.length(), i).equals(str)) {
                    i = i - str.length();
                    break;
                }
            } {
                String str = t[j];
                if(i - str.length() >= 0 && s.substring(i - str.length(), i).equals(str)) {
                    i = i - str.length();
                    break;
                }
            } String str = t[j]; str t[j] t j if(i - str.length() >= 0 && s.substring(i - str.length(), i).equals(str)) {
                    i = i - str.length();
                    break;
                } i - str.length() >= 0 && s.substring(i - str.length(), i).equals(str) i - str.length() >= 0 i - str.length() i str.length() str.length str 0 s.substring(i - str.length(), i).equals(str) s.substring(i - str.length(), i).equals s.substring(i - str.length(), i) s.substring s i - str.length() i str.length() str.length str i str {
                    i = i - str.length();
                    break;
                } i = i - str.length() i i - str.length() i str.length() str.length str break; if(j == t.length) {
                System.out.println("NO");
                return;
            } j == t.length j t.length t t.length {
                System.out.println("NO");
                return;
            } System.out.println("NO") System.out.println System.out System System.out "NO" return; System.out.println("YES") System.out.println System.out System System.out "YES" String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] t = new String[]{"dream", "dreamer", "erase", "eraser"};
        
        int i = s.length();
        while(i > 0) {
            int j = 0;
            for(; j < t.length; j++) {
                String str = t[j];
                if(i - str.length() >= 0 && s.substring(i - str.length(), i).equals(str)) {
                    i = i - str.length();
                    break;
                }
            }
            if(j == t.length) {
                System.out.println("NO");
                return;
            }
        }
        
        System.out.println("YES");
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] t = new String[]{"dream", "dreamer", "erase", "eraser"};
        
        int i = s.length();
        while(i > 0) {
            int j = 0;
            for(; j < t.length; j++) {
                String str = t[j];
                if(i - str.length() >= 0 && s.substring(i - str.length(), i).equals(str)) {
                    i = i - str.length();
                    break;
                }
            }
            if(j == t.length) {
                System.out.println("NO");
                return;
            }
        }
        
        System.out.println("YES");
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] t = new String[]{"dream", "dreamer", "erase", "eraser"};
        
        int i = s.length();
        while(i > 0) {
            int j = 0;
            for(; j < t.length; j++) {
                String str = t[j];
                if(i - str.length() >= 0 && s.substring(i - str.length(), i).equals(str)) {
                    i = i - str.length();
                    break;
                }
            }
            if(j == t.length) {
                System.out.println("NO");
                return;
            }
        }
        
        System.out.println("YES");
    }
}
