import java.util.Scanner;

public class Main {

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

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        int idx = S.length();

        while (true) {
            boolean endsWithStr = false;
            for (String str : strs) {
                if (idx - str.length() >= 0 && S.indexOf(str, idx - str.length()) == idx - str.length()) {
                    idx -= str.length();
                    endsWithStr = true;
                    break;
                }
            }
            if (!endsWithStr) {
                System.out.println("NO");
                break;
            }
            if (idx == 0) {
                System.out.println("YES");
                break;
            }
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {

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

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        int idx = S.length();

        while (true) {
            boolean endsWithStr = false;
            for (String str : strs) {
                if (idx - str.length() >= 0 && S.indexOf(str, idx - str.length()) == idx - str.length()) {
                    idx -= str.length();
                    endsWithStr = true;
                    break;
                }
            }
            if (!endsWithStr) {
                System.out.println("NO");
                break;
            }
            if (idx == 0) {
                System.out.println("YES");
                break;
            }
        }
    }
} Main static String[] strs = { "eraser", "erase", "dreamer", "dream" }; strs { "eraser", "erase", "dreamer", "dream" } "eraser" "erase" "dreamer" "dream" public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        int idx = S.length();

        while (true) {
            boolean endsWithStr = false;
            for (String str : strs) {
                if (idx - str.length() >= 0 && S.indexOf(str, idx - str.length()) == idx - str.length()) {
                    idx -= str.length();
                    endsWithStr = true;
                    break;
                }
            }
            if (!endsWithStr) {
                System.out.println("NO");
                break;
            }
            if (idx == 0) {
                System.out.println("YES");
                break;
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        int idx = S.length();

        while (true) {
            boolean endsWithStr = false;
            for (String str : strs) {
                if (idx - str.length() >= 0 && S.indexOf(str, idx - str.length()) == idx - str.length()) {
                    idx -= str.length();
                    endsWithStr = true;
                    break;
                }
            }
            if (!endsWithStr) {
                System.out.println("NO");
                break;
            }
            if (idx == 0) {
                System.out.println("YES");
                break;
            }
        }
    } 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 int idx = S.length(); idx S.length() S.length S while (true) {
            boolean endsWithStr = false;
            for (String str : strs) {
                if (idx - str.length() >= 0 && S.indexOf(str, idx - str.length()) == idx - str.length()) {
                    idx -= str.length();
                    endsWithStr = true;
                    break;
                }
            }
            if (!endsWithStr) {
                System.out.println("NO");
                break;
            }
            if (idx == 0) {
                System.out.println("YES");
                break;
            }
        } true {
            boolean endsWithStr = false;
            for (String str : strs) {
                if (idx - str.length() >= 0 && S.indexOf(str, idx - str.length()) == idx - str.length()) {
                    idx -= str.length();
                    endsWithStr = true;
                    break;
                }
            }
            if (!endsWithStr) {
                System.out.println("NO");
                break;
            }
            if (idx == 0) {
                System.out.println("YES");
                break;
            }
        } boolean endsWithStr = false; endsWithStr false for (String str : strs) {
                if (idx - str.length() >= 0 && S.indexOf(str, idx - str.length()) == idx - str.length()) {
                    idx -= str.length();
                    endsWithStr = true;
                    break;
                }
            } String str strs {
                if (idx - str.length() >= 0 && S.indexOf(str, idx - str.length()) == idx - str.length()) {
                    idx -= str.length();
                    endsWithStr = true;
                    break;
                }
            } {
                if (idx - str.length() >= 0 && S.indexOf(str, idx - str.length()) == idx - str.length()) {
                    idx -= str.length();
                    endsWithStr = true;
                    break;
                }
            } if (idx - str.length() >= 0 && S.indexOf(str, idx - str.length()) == idx - str.length()) {
                    idx -= str.length();
                    endsWithStr = true;
                    break;
                } idx - str.length() >= 0 && S.indexOf(str, idx - str.length()) == idx - str.length() idx - str.length() >= 0 idx - str.length() idx str.length() str.length str 0 S.indexOf(str, idx - str.length()) == idx - str.length() S.indexOf(str, idx - str.length()) S.indexOf S str idx - str.length() idx str.length() str.length str idx - str.length() idx str.length() str.length str {
                    idx -= str.length();
                    endsWithStr = true;
                    break;
                } idx -= str.length() idx str.length() str.length str endsWithStr = true endsWithStr true break; if (!endsWithStr) {
                System.out.println("NO");
                break;
            } !endsWithStr endsWithStr {
                System.out.println("NO");
                break;
            } System.out.println("NO") System.out.println System.out System System.out "NO" break; if (idx == 0) {
                System.out.println("YES");
                break;
            } idx == 0 idx 0 {
                System.out.println("YES");
                break;
            } System.out.println("YES") System.out.println System.out System System.out "YES" break; String[] args args public class Main {

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

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        int idx = S.length();

        while (true) {
            boolean endsWithStr = false;
            for (String str : strs) {
                if (idx - str.length() >= 0 && S.indexOf(str, idx - str.length()) == idx - str.length()) {
                    idx -= str.length();
                    endsWithStr = true;
                    break;
                }
            }
            if (!endsWithStr) {
                System.out.println("NO");
                break;
            }
            if (idx == 0) {
                System.out.println("YES");
                break;
            }
        }
    }
} public class Main {

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

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        int idx = S.length();

        while (true) {
            boolean endsWithStr = false;
            for (String str : strs) {
                if (idx - str.length() >= 0 && S.indexOf(str, idx - str.length()) == idx - str.length()) {
                    idx -= str.length();
                    endsWithStr = true;
                    break;
                }
            }
            if (!endsWithStr) {
                System.out.println("NO");
                break;
            }
            if (idx == 0) {
                System.out.println("YES");
                break;
            }
        }
    }
} Main
import java.util.Scanner;

public class Main {

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

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        int idx = S.length();

        while (true) {
            boolean endsWithStr = false;
            for (String str : strs) {
                if (idx - str.length() >= 0 && S.indexOf(str, idx - str.length()) == idx - str.length()) {
                    idx -= str.length();
                    endsWithStr = true;
                    break;
                }
            }
            if (!endsWithStr) {
                System.out.println("NO");
                break;
            }
            if (idx == 0) {
                System.out.println("YES");
                break;
            }
        }
    }
}
