import java.util.*;

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

        ArrayList<String> word_list = new ArrayList(Arrays.asList("dream", "dreamer", "erase", "eraser"));
        char[] S_char_list = new StringBuilder(S).reverse().toString().toCharArray();

        int idx = 0;
        int tmp_idx = 0;

        boolean next_flg = true;
        while (idx < S_char_list.length) {
            for (String word : word_list) {
                tmp_idx = idx;
                next_flg = true;
                for (int i = word.length() - 1; i >= 0; i--, tmp_idx++) {
                    if (S_char_list[tmp_idx] != word.charAt(i)) {
                        next_flg = false;
                        break;
                    }
                }
                if (next_flg) {
                    idx += word.length();
                    break;
                }
            }
            if (!next_flg)
                break;
        }

        System.out.println(idx >= S_char_list.length ? "YES" : "NO");
    }
} import java.util.*; util.* java public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();

        ArrayList<String> word_list = new ArrayList(Arrays.asList("dream", "dreamer", "erase", "eraser"));
        char[] S_char_list = new StringBuilder(S).reverse().toString().toCharArray();

        int idx = 0;
        int tmp_idx = 0;

        boolean next_flg = true;
        while (idx < S_char_list.length) {
            for (String word : word_list) {
                tmp_idx = idx;
                next_flg = true;
                for (int i = word.length() - 1; i >= 0; i--, tmp_idx++) {
                    if (S_char_list[tmp_idx] != word.charAt(i)) {
                        next_flg = false;
                        break;
                    }
                }
                if (next_flg) {
                    idx += word.length();
                    break;
                }
            }
            if (!next_flg)
                break;
        }

        System.out.println(idx >= S_char_list.length ? "YES" : "NO");
    }
} Main public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();

        ArrayList<String> word_list = new ArrayList(Arrays.asList("dream", "dreamer", "erase", "eraser"));
        char[] S_char_list = new StringBuilder(S).reverse().toString().toCharArray();

        int idx = 0;
        int tmp_idx = 0;

        boolean next_flg = true;
        while (idx < S_char_list.length) {
            for (String word : word_list) {
                tmp_idx = idx;
                next_flg = true;
                for (int i = word.length() - 1; i >= 0; i--, tmp_idx++) {
                    if (S_char_list[tmp_idx] != word.charAt(i)) {
                        next_flg = false;
                        break;
                    }
                }
                if (next_flg) {
                    idx += word.length();
                    break;
                }
            }
            if (!next_flg)
                break;
        }

        System.out.println(idx >= S_char_list.length ? "YES" : "NO");
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();

        ArrayList<String> word_list = new ArrayList(Arrays.asList("dream", "dreamer", "erase", "eraser"));
        char[] S_char_list = new StringBuilder(S).reverse().toString().toCharArray();

        int idx = 0;
        int tmp_idx = 0;

        boolean next_flg = true;
        while (idx < S_char_list.length) {
            for (String word : word_list) {
                tmp_idx = idx;
                next_flg = true;
                for (int i = word.length() - 1; i >= 0; i--, tmp_idx++) {
                    if (S_char_list[tmp_idx] != word.charAt(i)) {
                        next_flg = false;
                        break;
                    }
                }
                if (next_flg) {
                    idx += word.length();
                    break;
                }
            }
            if (!next_flg)
                break;
        }

        System.out.println(idx >= S_char_list.length ? "YES" : "NO");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc sc.close() sc.close sc ArrayList<String> word_list = new ArrayList(Arrays.asList("dream", "dreamer", "erase", "eraser")); word_list new ArrayList(Arrays.asList("dream", "dreamer", "erase", "eraser")) char[] S_char_list = new StringBuilder(S).reverse().toString().toCharArray(); S_char_list new StringBuilder(S).reverse().toString().toCharArray() new StringBuilder(S).reverse().toString().toCharArray new StringBuilder(S).reverse().toString() new StringBuilder(S).reverse().toString new StringBuilder(S).reverse() new StringBuilder(S).reverse new StringBuilder(S) int idx = 0; idx 0 int tmp_idx = 0; tmp_idx 0 boolean next_flg = true; next_flg true while (idx < S_char_list.length) {
            for (String word : word_list) {
                tmp_idx = idx;
                next_flg = true;
                for (int i = word.length() - 1; i >= 0; i--, tmp_idx++) {
                    if (S_char_list[tmp_idx] != word.charAt(i)) {
                        next_flg = false;
                        break;
                    }
                }
                if (next_flg) {
                    idx += word.length();
                    break;
                }
            }
            if (!next_flg)
                break;
        } idx < S_char_list.length idx S_char_list.length S_char_list S_char_list.length {
            for (String word : word_list) {
                tmp_idx = idx;
                next_flg = true;
                for (int i = word.length() - 1; i >= 0; i--, tmp_idx++) {
                    if (S_char_list[tmp_idx] != word.charAt(i)) {
                        next_flg = false;
                        break;
                    }
                }
                if (next_flg) {
                    idx += word.length();
                    break;
                }
            }
            if (!next_flg)
                break;
        } for (String word : word_list) {
                tmp_idx = idx;
                next_flg = true;
                for (int i = word.length() - 1; i >= 0; i--, tmp_idx++) {
                    if (S_char_list[tmp_idx] != word.charAt(i)) {
                        next_flg = false;
                        break;
                    }
                }
                if (next_flg) {
                    idx += word.length();
                    break;
                }
            } String word word_list {
                tmp_idx = idx;
                next_flg = true;
                for (int i = word.length() - 1; i >= 0; i--, tmp_idx++) {
                    if (S_char_list[tmp_idx] != word.charAt(i)) {
                        next_flg = false;
                        break;
                    }
                }
                if (next_flg) {
                    idx += word.length();
                    break;
                }
            } {
                tmp_idx = idx;
                next_flg = true;
                for (int i = word.length() - 1; i >= 0; i--, tmp_idx++) {
                    if (S_char_list[tmp_idx] != word.charAt(i)) {
                        next_flg = false;
                        break;
                    }
                }
                if (next_flg) {
                    idx += word.length();
                    break;
                }
            } tmp_idx = idx tmp_idx idx next_flg = true next_flg true for (int i = word.length() - 1; i >= 0; i--, tmp_idx++) {
                    if (S_char_list[tmp_idx] != word.charAt(i)) {
                        next_flg = false;
                        break;
                    }
                } int i = word.length() - 1; int i = word.length() - 1; i word.length() - 1 word.length() word.length word 1 i >= 0 i 0 i--, tmp_idx++ i-- i tmp_idx++ tmp_idx {
                    if (S_char_list[tmp_idx] != word.charAt(i)) {
                        next_flg = false;
                        break;
                    }
                } {
                    if (S_char_list[tmp_idx] != word.charAt(i)) {
                        next_flg = false;
                        break;
                    }
                } if (S_char_list[tmp_idx] != word.charAt(i)) {
                        next_flg = false;
                        break;
                    } S_char_list[tmp_idx] != word.charAt(i) S_char_list[tmp_idx] S_char_list tmp_idx word.charAt(i) word.charAt word i {
                        next_flg = false;
                        break;
                    } next_flg = false next_flg false break; if (next_flg) {
                    idx += word.length();
                    break;
                } next_flg {
                    idx += word.length();
                    break;
                } idx += word.length() idx word.length() word.length word break; if (!next_flg)
                break; !next_flg next_flg break; System.out.println(idx >= S_char_list.length ? "YES" : "NO") System.out.println System.out System System.out idx >= S_char_list.length ? "YES" : "NO" idx >= S_char_list.length idx S_char_list.length S_char_list S_char_list.length "YES" "NO" String... args args public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();

        ArrayList<String> word_list = new ArrayList(Arrays.asList("dream", "dreamer", "erase", "eraser"));
        char[] S_char_list = new StringBuilder(S).reverse().toString().toCharArray();

        int idx = 0;
        int tmp_idx = 0;

        boolean next_flg = true;
        while (idx < S_char_list.length) {
            for (String word : word_list) {
                tmp_idx = idx;
                next_flg = true;
                for (int i = word.length() - 1; i >= 0; i--, tmp_idx++) {
                    if (S_char_list[tmp_idx] != word.charAt(i)) {
                        next_flg = false;
                        break;
                    }
                }
                if (next_flg) {
                    idx += word.length();
                    break;
                }
            }
            if (!next_flg)
                break;
        }

        System.out.println(idx >= S_char_list.length ? "YES" : "NO");
    }
} public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();

        ArrayList<String> word_list = new ArrayList(Arrays.asList("dream", "dreamer", "erase", "eraser"));
        char[] S_char_list = new StringBuilder(S).reverse().toString().toCharArray();

        int idx = 0;
        int tmp_idx = 0;

        boolean next_flg = true;
        while (idx < S_char_list.length) {
            for (String word : word_list) {
                tmp_idx = idx;
                next_flg = true;
                for (int i = word.length() - 1; i >= 0; i--, tmp_idx++) {
                    if (S_char_list[tmp_idx] != word.charAt(i)) {
                        next_flg = false;
                        break;
                    }
                }
                if (next_flg) {
                    idx += word.length();
                    break;
                }
            }
            if (!next_flg)
                break;
        }

        System.out.println(idx >= S_char_list.length ? "YES" : "NO");
    }
} Main
import java.util.*;

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

        ArrayList<String> word_list = new ArrayList(Arrays.asList("dream", "dreamer", "erase", "eraser"));
        char[] S_char_list = new StringBuilder(S).reverse().toString().toCharArray();

        int idx = 0;
        int tmp_idx = 0;

        boolean next_flg = true;
        while (idx < S_char_list.length) {
            for (String word : word_list) {
                tmp_idx = idx;
                next_flg = true;
                for (int i = word.length() - 1; i >= 0; i--, tmp_idx++) {
                    if (S_char_list[tmp_idx] != word.charAt(i)) {
                        next_flg = false;
                        break;
                    }
                }
                if (next_flg) {
                    idx += word.length();
                    break;
                }
            }
            if (!next_flg)
                break;
        }

        System.out.println(idx >= S_char_list.length ? "YES" : "NO");
    }
}