import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        String S = cin.next();

        String[] words = {"dream", "dreamer", "erase", "eraser"};

        boolean[] dp = new boolean[S.length() + 1];

        dp[0] = true;

        for (int i = 0; i < S.length(); i++) {
            if (!dp[i]) {
                continue;
            }

            for (String word : words) {
                int end = i + word.length();
                if (end > S.length()) {
                    continue;
                }
                if (S.substring(i, end).equals(word)) {
                    dp[end] = true;
                }
            }
        }

        if (dp[S.length()]) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        String S = cin.next();

        String[] words = {"dream", "dreamer", "erase", "eraser"};

        boolean[] dp = new boolean[S.length() + 1];

        dp[0] = true;

        for (int i = 0; i < S.length(); i++) {
            if (!dp[i]) {
                continue;
            }

            for (String word : words) {
                int end = i + word.length();
                if (end > S.length()) {
                    continue;
                }
                if (S.substring(i, end).equals(word)) {
                    dp[end] = true;
                }
            }
        }

        if (dp[S.length()]) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} Main public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        String S = cin.next();

        String[] words = {"dream", "dreamer", "erase", "eraser"};

        boolean[] dp = new boolean[S.length() + 1];

        dp[0] = true;

        for (int i = 0; i < S.length(); i++) {
            if (!dp[i]) {
                continue;
            }

            for (String word : words) {
                int end = i + word.length();
                if (end > S.length()) {
                    continue;
                }
                if (S.substring(i, end).equals(word)) {
                    dp[end] = true;
                }
            }
        }

        if (dp[S.length()]) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    } main {
        Scanner cin = new Scanner(System.in);
        String S = cin.next();

        String[] words = {"dream", "dreamer", "erase", "eraser"};

        boolean[] dp = new boolean[S.length() + 1];

        dp[0] = true;

        for (int i = 0; i < S.length(); i++) {
            if (!dp[i]) {
                continue;
            }

            for (String word : words) {
                int end = i + word.length();
                if (end > S.length()) {
                    continue;
                }
                if (S.substring(i, end).equals(word)) {
                    dp[end] = true;
                }
            }
        }

        if (dp[S.length()]) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    } Scanner cin = new Scanner(System.in); cin new Scanner(System.in) String S = cin.next(); S cin.next() cin.next cin String[] words = {"dream", "dreamer", "erase", "eraser"}; words {"dream", "dreamer", "erase", "eraser"} "dream" "dreamer" "erase" "eraser" 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]) {
                continue;
            }

            for (String word : words) {
                int end = i + word.length();
                if (end > S.length()) {
                    continue;
                }
                if (S.substring(i, end).equals(word)) {
                    dp[end] = true;
                }
            }
        } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
            if (!dp[i]) {
                continue;
            }

            for (String word : words) {
                int end = i + word.length();
                if (end > S.length()) {
                    continue;
                }
                if (S.substring(i, end).equals(word)) {
                    dp[end] = true;
                }
            }
        } {
            if (!dp[i]) {
                continue;
            }

            for (String word : words) {
                int end = i + word.length();
                if (end > S.length()) {
                    continue;
                }
                if (S.substring(i, end).equals(word)) {
                    dp[end] = true;
                }
            }
        } if (!dp[i]) {
                continue;
            } !dp[i] dp[i] dp i {
                continue;
            } continue; for (String word : words) {
                int end = i + word.length();
                if (end > S.length()) {
                    continue;
                }
                if (S.substring(i, end).equals(word)) {
                    dp[end] = true;
                }
            } String word words {
                int end = i + word.length();
                if (end > S.length()) {
                    continue;
                }
                if (S.substring(i, end).equals(word)) {
                    dp[end] = true;
                }
            } {
                int end = i + word.length();
                if (end > S.length()) {
                    continue;
                }
                if (S.substring(i, end).equals(word)) {
                    dp[end] = true;
                }
            } int end = i + word.length(); end i + word.length() i word.length() word.length word if (end > S.length()) {
                    continue;
                } end > S.length() end S.length() S.length S {
                    continue;
                } continue; if (S.substring(i, end).equals(word)) {
                    dp[end] = true;
                } S.substring(i, end).equals(word) S.substring(i, end).equals S.substring(i, end) S.substring S i end word {
                    dp[end] = true;
                } dp[end] = true dp[end] dp end 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) {
        Scanner cin = new Scanner(System.in);
        String S = cin.next();

        String[] words = {"dream", "dreamer", "erase", "eraser"};

        boolean[] dp = new boolean[S.length() + 1];

        dp[0] = true;

        for (int i = 0; i < S.length(); i++) {
            if (!dp[i]) {
                continue;
            }

            for (String word : words) {
                int end = i + word.length();
                if (end > S.length()) {
                    continue;
                }
                if (S.substring(i, end).equals(word)) {
                    dp[end] = true;
                }
            }
        }

        if (dp[S.length()]) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        String S = cin.next();

        String[] words = {"dream", "dreamer", "erase", "eraser"};

        boolean[] dp = new boolean[S.length() + 1];

        dp[0] = true;

        for (int i = 0; i < S.length(); i++) {
            if (!dp[i]) {
                continue;
            }

            for (String word : words) {
                int end = i + word.length();
                if (end > S.length()) {
                    continue;
                }
                if (S.substring(i, end).equals(word)) {
                    dp[end] = true;
                }
            }
        }

        if (dp[S.length()]) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        String S = cin.next();

        String[] words = {"dream", "dreamer", "erase", "eraser"};

        boolean[] dp = new boolean[S.length() + 1];

        dp[0] = true;

        for (int i = 0; i < S.length(); i++) {
            if (!dp[i]) {
                continue;
            }

            for (String word : words) {
                int end = i + word.length();
                if (end > S.length()) {
                    continue;
                }
                if (S.substring(i, end).equals(word)) {
                    dp[end] = true;
                }
            }
        }

        if (dp[S.length()]) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}