import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String s = stdR.readLine();
        boolean[] dp = new boolean[s.length() + 1];
        dp[0] = true;
        for(int i = 0 ; i < s.length(); i++) {
            if(dp[i] == true) {
                if(i + 7 <= s.length() && s.substring(i, i + 7).equals("dreamer")) {
                    dp[i + 7] = true;
                }
                if(i + 6 <= s.length() && s.substring(i, i + 6).equals("eraser")) {
                    dp[i + 6] = true;
                }
                if(i + 5 <= s.length() && (s.substring(i, i + 5).equals("dream") || s.substring(i, i + 5).equals("erase"))) {
                    dp[i + 5] = true;
                }
            }
        }
        if(dp[s.length()]) {
            System.out.println("YES");
        }else {
            System.out.println("NO");
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String s = stdR.readLine();
        boolean[] dp = new boolean[s.length() + 1];
        dp[0] = true;
        for(int i = 0 ; i < s.length(); i++) {
            if(dp[i] == true) {
                if(i + 7 <= s.length() && s.substring(i, i + 7).equals("dreamer")) {
                    dp[i + 7] = true;
                }
                if(i + 6 <= s.length() && s.substring(i, i + 6).equals("eraser")) {
                    dp[i + 6] = true;
                }
                if(i + 5 <= s.length() && (s.substring(i, i + 5).equals("dream") || s.substring(i, i + 5).equals("erase"))) {
                    dp[i + 5] = true;
                }
            }
        }
        if(dp[s.length()]) {
            System.out.println("YES");
        }else {
            System.out.println("NO");
        }
    }
} Main public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String s = stdR.readLine();
        boolean[] dp = new boolean[s.length() + 1];
        dp[0] = true;
        for(int i = 0 ; i < s.length(); i++) {
            if(dp[i] == true) {
                if(i + 7 <= s.length() && s.substring(i, i + 7).equals("dreamer")) {
                    dp[i + 7] = true;
                }
                if(i + 6 <= s.length() && s.substring(i, i + 6).equals("eraser")) {
                    dp[i + 6] = true;
                }
                if(i + 5 <= s.length() && (s.substring(i, i + 5).equals("dream") || s.substring(i, i + 5).equals("erase"))) {
                    dp[i + 5] = true;
                }
            }
        }
        if(dp[s.length()]) {
            System.out.println("YES");
        }else {
            System.out.println("NO");
        }
    } main {
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String s = stdR.readLine();
        boolean[] dp = new boolean[s.length() + 1];
        dp[0] = true;
        for(int i = 0 ; i < s.length(); i++) {
            if(dp[i] == true) {
                if(i + 7 <= s.length() && s.substring(i, i + 7).equals("dreamer")) {
                    dp[i + 7] = true;
                }
                if(i + 6 <= s.length() && s.substring(i, i + 6).equals("eraser")) {
                    dp[i + 6] = true;
                }
                if(i + 5 <= s.length() && (s.substring(i, i + 5).equals("dream") || s.substring(i, i + 5).equals("erase"))) {
                    dp[i + 5] = true;
                }
            }
        }
        if(dp[s.length()]) {
            System.out.println("YES");
        }else {
            System.out.println("NO");
        }
    } BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in)); stdR new BufferedReader(new InputStreamReader(System.in)) String s = stdR.readLine(); s stdR.readLine() stdR.readLine stdR boolean[] dp = new boolean[s.length() + 1]; dp new boolean[s.length() + 1] s.length() + 1 s.length() s.length s 1 dp[0] = true dp[0] dp 0 true for(int i = 0 ; i < s.length(); i++) {
            if(dp[i] == true) {
                if(i + 7 <= s.length() && s.substring(i, i + 7).equals("dreamer")) {
                    dp[i + 7] = true;
                }
                if(i + 6 <= s.length() && s.substring(i, i + 6).equals("eraser")) {
                    dp[i + 6] = true;
                }
                if(i + 5 <= s.length() && (s.substring(i, i + 5).equals("dream") || s.substring(i, i + 5).equals("erase"))) {
                    dp[i + 5] = true;
                }
            }
        } int i = 0 ; int i = 0 ; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            if(dp[i] == true) {
                if(i + 7 <= s.length() && s.substring(i, i + 7).equals("dreamer")) {
                    dp[i + 7] = true;
                }
                if(i + 6 <= s.length() && s.substring(i, i + 6).equals("eraser")) {
                    dp[i + 6] = true;
                }
                if(i + 5 <= s.length() && (s.substring(i, i + 5).equals("dream") || s.substring(i, i + 5).equals("erase"))) {
                    dp[i + 5] = true;
                }
            }
        } {
            if(dp[i] == true) {
                if(i + 7 <= s.length() && s.substring(i, i + 7).equals("dreamer")) {
                    dp[i + 7] = true;
                }
                if(i + 6 <= s.length() && s.substring(i, i + 6).equals("eraser")) {
                    dp[i + 6] = true;
                }
                if(i + 5 <= s.length() && (s.substring(i, i + 5).equals("dream") || s.substring(i, i + 5).equals("erase"))) {
                    dp[i + 5] = true;
                }
            }
        } if(dp[i] == true) {
                if(i + 7 <= s.length() && s.substring(i, i + 7).equals("dreamer")) {
                    dp[i + 7] = true;
                }
                if(i + 6 <= s.length() && s.substring(i, i + 6).equals("eraser")) {
                    dp[i + 6] = true;
                }
                if(i + 5 <= s.length() && (s.substring(i, i + 5).equals("dream") || s.substring(i, i + 5).equals("erase"))) {
                    dp[i + 5] = true;
                }
            } dp[i] == true dp[i] dp i true {
                if(i + 7 <= s.length() && s.substring(i, i + 7).equals("dreamer")) {
                    dp[i + 7] = true;
                }
                if(i + 6 <= s.length() && s.substring(i, i + 6).equals("eraser")) {
                    dp[i + 6] = true;
                }
                if(i + 5 <= s.length() && (s.substring(i, i + 5).equals("dream") || s.substring(i, i + 5).equals("erase"))) {
                    dp[i + 5] = true;
                }
            } if(i + 7 <= s.length() && s.substring(i, i + 7).equals("dreamer")) {
                    dp[i + 7] = true;
                } i + 7 <= s.length() && s.substring(i, i + 7).equals("dreamer") i + 7 <= s.length() i + 7 i 7 s.length() s.length s s.substring(i, i + 7).equals("dreamer") s.substring(i, i + 7).equals s.substring(i, i + 7) s.substring s i i + 7 i 7 "dreamer" {
                    dp[i + 7] = true;
                } dp[i + 7] = true dp[i + 7] dp i + 7 i 7 true if(i + 6 <= s.length() && s.substring(i, i + 6).equals("eraser")) {
                    dp[i + 6] = true;
                } i + 6 <= s.length() && s.substring(i, i + 6).equals("eraser") i + 6 <= s.length() i + 6 i 6 s.length() s.length s s.substring(i, i + 6).equals("eraser") s.substring(i, i + 6).equals s.substring(i, i + 6) s.substring s i i + 6 i 6 "eraser" {
                    dp[i + 6] = true;
                } dp[i + 6] = true dp[i + 6] dp i + 6 i 6 true if(i + 5 <= s.length() && (s.substring(i, i + 5).equals("dream") || s.substring(i, i + 5).equals("erase"))) {
                    dp[i + 5] = true;
                } i + 5 <= s.length() && (s.substring(i, i + 5).equals("dream") || s.substring(i, i + 5).equals("erase")) i + 5 <= s.length() i + 5 i 5 s.length() s.length s (s.substring(i, i + 5).equals("dream") || s.substring(i, i + 5).equals("erase")) s.substring(i, i + 5).equals("dream") s.substring(i, i + 5).equals s.substring(i, i + 5) s.substring s i i + 5 i 5 "dream" s.substring(i, i + 5).equals("erase") s.substring(i, i + 5).equals s.substring(i, i + 5) s.substring s i i + 5 i 5 "erase" {
                    dp[i + 5] = true;
                } dp[i + 5] = true dp[i + 5] dp i + 5 i 5 true if(dp[s.length()]) {
            System.out.println("YES");
        }else {
            System.out.println("NO");
        } dp[s.length()] dp s.length() s.length s {
            System.out.println("YES");
        } System.out.println("YES") System.out.println System.out System System.out "YES" {
            System.out.println("NO");
        } System.out.println("NO") System.out.println System.out System System.out "NO" String args[] args public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String s = stdR.readLine();
        boolean[] dp = new boolean[s.length() + 1];
        dp[0] = true;
        for(int i = 0 ; i < s.length(); i++) {
            if(dp[i] == true) {
                if(i + 7 <= s.length() && s.substring(i, i + 7).equals("dreamer")) {
                    dp[i + 7] = true;
                }
                if(i + 6 <= s.length() && s.substring(i, i + 6).equals("eraser")) {
                    dp[i + 6] = true;
                }
                if(i + 5 <= s.length() && (s.substring(i, i + 5).equals("dream") || s.substring(i, i + 5).equals("erase"))) {
                    dp[i + 5] = true;
                }
            }
        }
        if(dp[s.length()]) {
            System.out.println("YES");
        }else {
            System.out.println("NO");
        }
    }
} public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String s = stdR.readLine();
        boolean[] dp = new boolean[s.length() + 1];
        dp[0] = true;
        for(int i = 0 ; i < s.length(); i++) {
            if(dp[i] == true) {
                if(i + 7 <= s.length() && s.substring(i, i + 7).equals("dreamer")) {
                    dp[i + 7] = true;
                }
                if(i + 6 <= s.length() && s.substring(i, i + 6).equals("eraser")) {
                    dp[i + 6] = true;
                }
                if(i + 5 <= s.length() && (s.substring(i, i + 5).equals("dream") || s.substring(i, i + 5).equals("erase"))) {
                    dp[i + 5] = true;
                }
            }
        }
        if(dp[s.length()]) {
            System.out.println("YES");
        }else {
            System.out.println("NO");
        }
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String s = stdR.readLine();
        boolean[] dp = new boolean[s.length() + 1];
        dp[0] = true;
        for(int i = 0 ; i < s.length(); i++) {
            if(dp[i] == true) {
                if(i + 7 <= s.length() && s.substring(i, i + 7).equals("dreamer")) {
                    dp[i + 7] = true;
                }
                if(i + 6 <= s.length() && s.substring(i, i + 6).equals("eraser")) {
                    dp[i + 6] = true;
                }
                if(i + 5 <= s.length() && (s.substring(i, i + 5).equals("dream") || s.substring(i, i + 5).equals("erase"))) {
                    dp[i + 5] = true;
                }
            }
        }
        if(dp[s.length()]) {
            System.out.println("YES");
        }else {
            System.out.println("NO");
        }
    }
}