import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int N = S.length();
        String[] words = {
            "dream",
            "dreamer",
            "erase",
            "eraser"
        };
        boolean[] dp = new boolean[N+1];
        dp[0] = true;
        for (int i = 0; i < N; i++) {
            if (dp[i]) {
                for (String w : words) {
                    if (S.startsWith(w, i)) {
                        dp[i + w.length()] = true;
                    }
                }
            }
        }
        System.out.println(dp[N] ? "YES" : "NO");
        
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int N = S.length();
        String[] words = {
            "dream",
            "dreamer",
            "erase",
            "eraser"
        };
        boolean[] dp = new boolean[N+1];
        dp[0] = true;
        for (int i = 0; i < N; i++) {
            if (dp[i]) {
                for (String w : words) {
                    if (S.startsWith(w, i)) {
                        dp[i + w.length()] = true;
                    }
                }
            }
        }
        System.out.println(dp[N] ? "YES" : "NO");
        
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int N = S.length();
        String[] words = {
            "dream",
            "dreamer",
            "erase",
            "eraser"
        };
        boolean[] dp = new boolean[N+1];
        dp[0] = true;
        for (int i = 0; i < N; i++) {
            if (dp[i]) {
                for (String w : words) {
                    if (S.startsWith(w, i)) {
                        dp[i + w.length()] = true;
                    }
                }
            }
        }
        System.out.println(dp[N] ? "YES" : "NO");
        
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int N = S.length();
        String[] words = {
            "dream",
            "dreamer",
            "erase",
            "eraser"
        };
        boolean[] dp = new boolean[N+1];
        dp[0] = true;
        for (int i = 0; i < N; i++) {
            if (dp[i]) {
                for (String w : words) {
                    if (S.startsWith(w, i)) {
                        dp[i + w.length()] = true;
                    }
                }
            }
        }
        System.out.println(dp[N] ? "YES" : "NO");
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc int N = S.length(); N S.length() S.length S String[] words = {
            "dream",
            "dreamer",
            "erase",
            "eraser"
        }; words {
            "dream",
            "dreamer",
            "erase",
            "eraser"
        } "dream" "dreamer" "erase" "eraser" boolean[] dp = new boolean[N+1]; dp new boolean[N+1] N+1 N 1 dp[0] = true dp[0] dp 0 true for (int i = 0; i < N; i++) {
            if (dp[i]) {
                for (String w : words) {
                    if (S.startsWith(w, i)) {
                        dp[i + w.length()] = true;
                    }
                }
            }
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            if (dp[i]) {
                for (String w : words) {
                    if (S.startsWith(w, i)) {
                        dp[i + w.length()] = true;
                    }
                }
            }
        } {
            if (dp[i]) {
                for (String w : words) {
                    if (S.startsWith(w, i)) {
                        dp[i + w.length()] = true;
                    }
                }
            }
        } if (dp[i]) {
                for (String w : words) {
                    if (S.startsWith(w, i)) {
                        dp[i + w.length()] = true;
                    }
                }
            } dp[i] dp i {
                for (String w : words) {
                    if (S.startsWith(w, i)) {
                        dp[i + w.length()] = true;
                    }
                }
            } for (String w : words) {
                    if (S.startsWith(w, i)) {
                        dp[i + w.length()] = true;
                    }
                } String w words {
                    if (S.startsWith(w, i)) {
                        dp[i + w.length()] = true;
                    }
                } {
                    if (S.startsWith(w, i)) {
                        dp[i + w.length()] = true;
                    }
                } if (S.startsWith(w, i)) {
                        dp[i + w.length()] = true;
                    } S.startsWith(w, i) S.startsWith S w i {
                        dp[i + w.length()] = true;
                    } dp[i + w.length()] = true dp[i + w.length()] dp i + w.length() i w.length() w.length w true System.out.println(dp[N] ? "YES" : "NO") System.out.println System.out System System.out dp[N] ? "YES" : "NO" dp[N] dp N "YES" "NO" String[] args args
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int N = S.length();
        String[] words = {
            "dream",
            "dreamer",
            "erase",
            "eraser"
        };
        boolean[] dp = new boolean[N+1];
        dp[0] = true;
        for (int i = 0; i < N; i++) {
            if (dp[i]) {
                for (String w : words) {
                    if (S.startsWith(w, i)) {
                        dp[i + w.length()] = true;
                    }
                }
            }
        }
        System.out.println(dp[N] ? "YES" : "NO");
        
    }
}